add_rewrite_rules not working!
-
Hi.
I want to add custom rewrite rules for posts and categories and …
for example for categories:
https://site/cat/%5Bcatid%5D
and for posts:
https://site/post/%5Bpostid%5D
the default permalink settings is set and the rewrite rules array is empty.
i used this code for testing if it works or not :<?php function custom_rewrite_basic() { add_rewrite_rule('^post/([0-9]*)/?', 'index.php?p=$matches[1]', 'top'); } add_action('init', 'custom_rewrite_basic'); ?>
and then flushed rewrite rules through clicking save in permalink settings in admin.
but still the array of rewrite rules is empty and there is no changes to permalink.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘add_rewrite_rules not working!’ is closed to new replies.