Where to insert add_rewrite_rule?
-
Sorry, this problem was discussed, and rezolved with the code:
function add_my_var($public_query_vars) { $public_query_vars[] = 'myvar'; return $public_query_vars; } add_filter('query_vars', 'add_my_var'); function do_rewrite() { add_rewrite_rule('mypage/([^/]+)/?$', 'index.php?pagename=mypage&myvar=$matches[1]','top'); } add_action('init', 'do_rewrite');
Where should I add that code? What file should I use and what section?
I have a plugin installed that sets the URL’s like this: wordress/pagename/?var=xt
i want it to be like:
wordpress/pagename/xtWhere wordpress is the wordpress base (https://domain.com/wordpress/)
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Where to insert add_rewrite_rule?’ is closed to new replies.