How to rewrite URL back to default custom URL if no destination found
How to rewrite URL back to default custom URL if no destination found
How to rewrite URL back to default custom URL if no destination found
Found the way, For anyone looking for a method in the future I’ll mention how I made it work. add_action( ‘parse_request’, function($query){ $post_type = $post_name = NULL; if (isset($query->query_vars[‘post_type’]) && in_array($query->query_vars[‘post_type’], [‘colors’, ‘shapes’])) { $post_type = $query->query_vars[‘post_type’]; $post_name = $query->query_vars[‘name’]; } elseif (isset($query->query_vars[‘pagename’]) && isset($query->request) && isset(explode(“https://wordpress.stackexchange.com/”, $query->request)[0]) && in_array(explode(“https://wordpress.stackexchange.com/”, $query->request)[0], [‘slug-with-no-post-type’, ‘another-slug-with-no-post-type’])) { $division … Read more
You shouldn’t need to manually handle this with hooks & custom slug settings – just ensure hierarchical is set to true in your register_post_type arguments. You mention “CPT UI” settings, are you referring to the Custom Post Type UI plugin? If so, make sure Hierarchical is set to True in the Settings metabox.
Custom WooCommerce rewrite rules with comma delimiter
How to change an existing wordpress page rewrite rule?
‘^offer/([^/]*)/([^/]*)/?’, Why do you have a question mark here at the end, that doesn’t do anything here. You also need to add_rewrite_tag otherwise it will never work.
Prevent Buddypress Rewrite Rules on Non-Buddypress pages/posts
When request has multiple matching rewrite rules, and matched rule returns 404 – iterate to next rewrite rule
WordPress rewrite rule doesn’t work unless post category is explicitly called in regex
Safest way to create a custom permalink