Tag Info

Hot answers tagged

2

Thanks to @Milo on the comments, I'm gonna post my answer: Firstly I added this rule: add_rewrite_rule( "en/artist/([^/]+)/?", 'index.php?pagename=post_type=artist&artist=$matches[1]&gal_template=en', "top"); Then this filter: add_filter( 'query_vars', 'gal_query_vars' ); function gal_query_vars( $query_vars ) { ...


1

When you register your taxonomy, set the slug parameter of rewrite to your desired structure: register_taxonomy( 'custom_tax', 'custom_post_type', array( 'rewrite' => array( 'slug' => 'your-cpt-slug/category' ), // your other args... ) );


1

In order to rewrite a custom post type's URL, or permalink, you'll need to filter the 'post_type_link', which is run whenever get_permalink() is called, allowing you to change a post's permalink. I've include some guide code below. It seems like you have a handle on the rewrite rules but let me know if you need more help. add_filter( 'post_type_link', ...


1

This here is a clarification and addition to Rachel's answer. Combining this together with her code will produce the full solution(I was advised to put this here by a moderator rather than editing the question with an update. I give 100% credit for this answer to Rachel) <?php //rewrite rules for discography, news, albums,songs function ex_rewrite(){ ...


1

You can use add_rewrite_endpoint, which will add a query var and generate the necessary rewrite rules: function wpd_cid_endpoint() { add_rewrite_endpoint( 'cid', EP_PERMALINK ); } add_action( 'init', 'wpd_cid_endpoint' ); Don't forget to flush rewrite rules after changing rules. You can do this quickly by visiting the Settings > Permalinks page in ...



Only top voted, non community-wiki answers of a minimum length are eligible