Mixing custom post type and taxonomy rewrite structures?

You can always override the template that will be called with the template_include or a related filter, but this might hide deeper problems with custom archives. As I understand it, you want to use the following structure: /glossary/ should be an archive page for all sumo-glossary-term posts /glossary/[letter]/ should be an archive page for posts … Read more

Permalinks: custom post type -> custom taxonomy -> post

First, register your taxonomy and set the slug argument of rewrite to shows: register_taxonomy( ‘show_category’, ‘show’, array( ‘rewrite’ => array( ‘slug’ => ‘shows’, ‘with_front’ => false ), // your other args… ) ); Next, register your post type and set the slug to shows/%show_category%, and set has_archive argument to shows: register_post_type( ‘show’, array( ‘rewrite’ => … Read more

Need help with add_rewrite_rule

Some background on rewrite rules The WP Rewrite system looks complicated, but in fact it’s not that hard to understand how it works. It is used to parse pretty URLs (/designers/) as if they were non-pretty (/index.php?pagename=designers). The basic idea is that you have a list of rewrite rules, regular expressions that can match the … Read more

How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name

After combining a bunch of pieces of other answers I got it working! So here’s the solution for those of you who are struggling with this too: This post and this one helped me out some, so thanks to those guys. Note, all this code, plus your initial custom post type and taxonomy registration code … Read more

Custom post types, taxonomies, and permalinks

Change slug in your post type arguments to products/%product_cat%, and slug in your taxonomy arguments to just products, then flush your rewrite rules. WordPress should now handle /products/my-product-cat/post-name/! Now finally, we need to help WordPress a little with generating permalinks (out of the box, it won’t recognise the permastruct tag %product_cat%): /** * Inject term … Read more

How to get URL of current page displayed?

get_permalink() is only really useful for single pages and posts, and only works inside the loop. The simplest way I’ve seen is this: global $wp; echo home_url( $wp->request ) $wp->request includes the path part of the URL, eg. /path/to/page and home_url() outputs the URL in Settings > General, but you can append a path to … Read more

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş