Rewrite taxonomy permalink appended to CPT archive url

There are 2 possible ways to fix the issue with the term’s permalinks (which is currently using the wrong query var name – intvn-cat): Easy. Just set the 3rd parameter for add_rewrite_tag() to intervention_cat=. I.e. add_rewrite_tag( ‘%intvn-cat%’, ‘(.+)’, ‘intervention_cat=” ); This is what I would actually do – Remove the add_rewrite_tag() part in your code, … Read more

How does WordPress manage to differentiate between post and page URLs without a distinct base, and how can I replicate this functionality?

I dont know how I missed out on that while looking for aproaches, but I have a working solution now based on this answer. I modified it to check for slashes in $query->request, if there is none I first look for my custom post type (get_posts() with’slug’ => $query->request). If no post is found I … Read more

How to add random prefix (based on related page slug) to custom post type?

Resolved! So I’ve added rewrite rule: add_rewrite_rule( ‘^[^\/]*\/review\/([^\/]*)$’, ‘index.php?review=$matches[1]’, ‘top’ ); And additional code to create appropriate url structure: function rev_update_slug( $post_link, $post, $leavename ) { if ( ‘review’ != $post->post_type || ‘publish’ != $post->post_status ) { return $post_link; } //** Field where related page post object stored in ACF field **// $pageid= get_field(‘related_home_inner_page’,$post->ID); $post_link … Read more

How to write ReWrite Rule to cut URL?

First add the rewrite rule: function wpse426504_add_rewrite() { add_rewrite_rule( ‘mycontent/events/([a-z0-9-]+)[/]?$’, ‘index.php?eventslug=$matches[1]’, ‘top’ ); } add_action( ‘init’, ‘wpse426504_add_rewrite’ ); function wpse426504_add_query_var( $query_vars ) { $query_vars[] = ‘eventslug’; return $query_vars; } ); add_filter( ‘query_vars’, ‘wpse426504_add_query_var’ ); That’s the basics of it. If you need to add a new template to handle displaying everything, you’d then hook to … Read more

techhipbettruvabetnorabahisbahis forumutaraftarium24edusedueduseduedueduseduseduedusedus