Problems with own rewrite rules and query vars
-
Hello folks,
I’m new to WordPress and tried to start writing my first own plugin the last days. Currentley I try to set up an specific url structure. I’ve written a plugin with a hook:
function pgnet_test_createRewriteRules($rewrite) { global $wp_rewrite; // relevant tokens $token_tour = '%tour%'; $token_leg = '%leg%'; // register url tags $wp_rewrite->add_rewrite_tag($token_tour, '(.+?)', 'tour='); $wp_rewrite->add_rewrite_tag($token_leg, '(.+?)', 'leg='); // url structure & add rewrite rule $url_structure = $wp_rewrite->root . 'live-database/' . $token_tour . '/' . $token_leg; $url_rewrite = $wp_rewrite->generate_rewrite_rules($url_structure); return ($url_rewrite + $rewrite); } add_filter('rewrite_rules_array', 'pgnet_test_createRewriteRules');
So when I try to access a url of that kind, like mydomain.tld/live-database/tourname/legname I expected to get the defined tags as a parameter in the query vars but it doesn’t work. What should I have to do?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Problems with own rewrite rules and query vars’ is closed to new replies.