How to make nested custom post type slugs work
How to make nested custom post type slugs work
How to make nested custom post type slugs work
It’s a bit simpler to let WordPress handle generating the permastruct when you register your post type. I also recommend against using global variables, there are API functions for most of what you need to accomplish with the rewrite class. function magazine_issues_rewrite() { add_rewrite_tag( ‘%issuenumber%’, ‘([^&]+)’ ); add_rewrite_tag( ‘%issueyear%’, ‘([^&]+)’ ); // post type registration, … Read more
I made modification of rules, now it is working fine. #For post page URLs RewriteRule ^(.*)-some-category-suffix(.*)-some-category-suffix(.*).jpg.html(.*)$ /category-url/$1$2$3.html [L,R=301] #For post add-on page URLs RewriteRule ^(.*)full-size/(.*)-some-category-suffix(.*)-some-category-suffix(.*).jpg-(.*)(.*).html$ /category-url/$1$2$3$4.html?-$5$6 [L,R=301] #Category URLs RewriteRule ^(.*)-some-category-suffix(.*)-some-category-suffix(.*)$ /category_url/$1$2$3 [L,R=301]
Permalink broken for pages after adding rewrite rule
Always flush the rewrite rules when you register a new public post type or taxonomy. Otherwise the internal rewrite rules will not take that into account when an URL is mapped to a query. You can automate that process by hooking into registered_post_type and registered_taxonomy. Below is the updated code, based on feedback from comments … Read more
My recommendation is to register a custom post type. You can call it products, and then all posts placed under Products will get the http://domain.com/products/some-product rewrite. Once it’s its own post type, you can specify a custom template for it, single-product.php, and you can add any custom fields, classes, etc. from there.
After weeks of fiddling around and trying all sorts of tricks, I finally figured it out. There we’re two things I was doing wrong, I wanted wordpress to be able to access get last two value’s in between slashes as GET parameters when an url like this /examentraining/vak/VAKNAME/LEVELNAME/ is submitted to WordPress. p=1316&vakname=VAKNAME&level=LEVELNAME => /examentraining/vak/VAKNAME/LEVELNAME/ … Read more
You have to register your post type before you flush the rules. Your init action doesn’t run on plugin activation, so your flush_rewrite method should call register_content_types first before flushing the rules.
Parent cpt/child custom post type URL permalink relationship
get_permalink is getting old rewrite rule