How to test custom rewrite rules /permalinks?
Check out my favorite Rewrite Analyzer plugin written by @Jan Fabry. It allows you to analyze your rewrite rules and really helps in debugging those rules.
Check out my favorite Rewrite Analyzer plugin written by @Jan Fabry. It allows you to analyze your rewrite rules and really helps in debugging those rules.
404 error using Meta for Permalink rewrite
Rewrite tags aren’t used in the context of add_rewrite_rule. If you were to use your tag in the post permalink settings under Settings > Permalinks, then your tag would be present in the link passed to the post_link filter. I think you need to add a new permalink structure containing the tag directly to the … Read more
The first rule is capturing all requests. If you add a $ anchor at the end of the rules, they’ll behave as expected (you could also just switch the order of the rules so the more specific one “wins”). add_rewrite_rule( ‘^app/course/([^/]+)/?$’, ‘index.php?page_id=3400&course=matches[1]’, ‘top’ ); add_rewrite_rule( ‘^app/course/([^/]+)/theme/([^/]+)/?$’, ‘index.php?page_id=3400&course=$matches[1]&theme=$matches[2]’, ‘top’ ); Check out Monkeyman Rewrite Analyzer for … Read more
Custom permalink leads to index page
Rewrite URLs – Custom Post Type – Post Slug, Taxonamy Slug
After a lot of inspection of rewrites happening under the hood by hooking into filters and logging variable values, I managed to solve the problem! Queries and query rewriting When a query occurs, WordPress will serve the content using the correct template as soon as it has enough info to unambiguously determine what the template … Read more
Indeed, you need to add the rewrite tags. They indicate what can come in the place of your %cal_year% and similar tags: add_rewrite_tag( ‘%cal_year%’, ‘([0-9]{4})’ ); add_rewrite_tag( ‘%cal_month%’, ‘([0-9]{1,2})’ ); add_rewrite_tag( ‘%cal_day%’, ‘([0-9]{1,2})’ ); This works, but I don’t understand how: it seems to me something is missing to let WordPress know how it should … Read more
There are various ways to achieve it. The most simplest one could be to make a new page and with name “en” so the slug will be mysite.com/en/ Now make the “en” page as parent of my-page-name or in other words make my-page-name as a child of en. So slug will be mysite.com/en/my-page-name/
I think this does what you’re trying to achieve. Regarding multisite 404s, you have to flush rewrite rules on every site within multisite where you want this rule to get added. A quick method for testing purposes is to visit the permalinks settings page for each site you’re testing. Also note, I removed the .php … Read more