Remove date rewrite rule for custom post type archive page

You have just a little mistake in your preg_match, instead of this: if ( preg_match(‘/(year=\$matches|monthnum=\$matches)/’, $rewrite) ) { do this: if ( preg_match(‘/(year=\$matches|monthnum=\$matches\/)/’, $rewrite) ) { I was looking for a solution to clean a lot of rules, this source is useful: https://wpreset.com/remove-default-wordpress-rewrite-rules-permalinks/ My final code is this, it can be customized allowing more or … Read more

Creating subpages for each custom post type

Yes, setting the hierarchical option to true when you register the custom post type will mean each of your “shop pages” can have child “shop pages.” So you could have example.com/shop/shop-name/ example.com/shop/shop-name/hours/ example.com/shop/shop-name/contact/ etc. I believe ACF has a simple toggle to enable the hierarchical option. If you were registering it in code, you would … Read more