Custom rewrite rule now working with custom_rewrite_basic
-
I’ve read through the documentation about setting up rewrites in WordPres using custom_rewrite_basic, but am having some trouble.
In a nutshell, I’m working on a site with a video category page:
example.com/article/category/videos/
The category page takes a querystring param ?video=XXXX where XXXX is an ID that is used to set the default video.
I’d like to mod_rewrite from:
/article/category/videos/XXXX to /article/category/videos/?video=XXXX
I’ve determined that the category is category 9, and tried the following rule with no luck:
function custom_rewrite_basic() { add_rewrite_rule('^article/category/videos/([^/]*)$', '/index.php?cat=9&video=$matches[1]', 'top'); } add_action('init', 'custom_rewrite_basic'); // Get ad zone ID detail include(get_template_directory().'/301adconfig.php');
Any assistance would be greatly appreciated.
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Custom rewrite rule now working with custom_rewrite_basic’ is closed to new replies.