mercredi 29 avril 2015

Wordpress rewrite table plugin

I'm looking for a solution to rewrite URL in Wordpress site, in such way to keep it compatible with the previous website.

So, with the following code:

function custom_rewrite_basic() {
  add_rewrite_rule('^whatever/([0-9]+)/?', 'index.php?page_id=$matches[1]', 'top');
}
add_action('init', 'custom_rewrite_basic');

... Wordpress will redirect /whatever/123 to index.page?page_id=123, but what I want is not an redirect, but to keep whatever/123 in URL. In this case, redirection works and URL became permalink from Permalink Common Settings, which is not desirable solution.

Aucun commentaire:

Enregistrer un commentaire