Skip to content

Instantly share code, notes, and snippets.

@andrebian
Created September 17, 2014 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrebian/8c36b611c85957fe9aa7 to your computer and use it in GitHub Desktop.
Save andrebian/8c36b611c85957fe9aa7 to your computer and use it in GitHub Desktop.
Rewrite personalizado do WordPress
<?php
// ...
function eg_add_rewrite_rules()
{
global $wp_rewrite;
$new_rules = array(
'viagens/[^/]+/perguntas-frequentes/?$' => 'index.php?page_id=33',
'experiencias/(.+)/?$' => 'index.php?page_id=31',
);
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}
add_action( 'generate_rewrite_rules', 'eg_add_rewrite_rules' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment