Redirect when visiting a page with a custom rewrite_rule
-
Hello! Thanks so much for the great plugin. It works well, but today it encountered the following error:
I added the following code in the function.phpfunction custom_rewrite_basic() { add_rewrite_tag('%blog_category%','([^&]+)'); add_rewrite_rule('^blog/category/([0-9a-zA-Z+-]+)/?', 'index.php?pagename=blog&blog_category=$matches[1]', 'top'); } add_action('init', 'custom_rewrite_basic', 1);
It works when the plugin is disabled. For example, I can go on URL: “www.site.com/blog/category/my-cat” and it will work.
But when the plugin is enabled, during a visit to this link, redirecting to “www.site.com/blog” occurs (screenshot)
P.S.
Blog – this is the real page that exists on the site.Please tell me what could be the problem..
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Redirect when visiting a page with a custom rewrite_rule’ is closed to new replies.