Articles of permalinks

Custom rewrite rules for archive page and single post

I’m building a WordPress site with several custom post types. Every post type is a different magazine. I have also a custom meta fields for a magazine year and issue. I would like to have urls (used archive.php): http://my_site/magazine/name/ http://my_site/magazine_name/year/ http://my_site/magazine_name/year/issue/ I made it by code: function magazine_rewrite_tag() { add_rewrite_tag(‘%issue_year%’, ‘([0-9]{4})’); add_rewrite_tag(‘%issue%’, ‘([0-9])’); } add_action(‘init’, […]

How to remove slug from hierarchical custom types in 3.5.2

I know that is not suggested and that there is lots of discussion about this argument out there. Unfortunally, after a week of trying and tests, I have not managed to remove the slug from my custom type yet. Here’s the situation: The url structure I need post /blog/my-blog-post [ok!] pages /parent-service/service [ok!] portfolio /portfolio/my-first-work […]

Can't get a custom template taxonomy page to display

I’ve been trying to wade my way through learning the ins and outs of taxonomies and how to integrate them into themes and I’ve run into a pretty basic issue that I can’t seem to figure out. I started working on this in a BuddyPress install using More Taxonomies. After not being able to get […]

Resolve a custom post type name vs. page permalink conflict (same slug)

I have a custom post type called “visningshus”, and also a Page with that slug. This is as it should (must) be. Currently, “” lists all posts of that type. I want to show the page that has that permalink slug instead. How can I make WordPress not make the post type name take precedence, […]

Mapping Domains to Permalinks (not multisite)

I am trying to do this on a standalone WP installation (not multisite). What I am trying to achieve is: User saves on usermeta. (done) User creates a new CPT, say company. Which is accessible via by default (done – by default) I need all the posts created by the user to make […]

Where, When, & How to Properly Flush Rewrite Rules Within the Scope of a Plugin?

I am having a bit of a strange issue with rewrite rules not flushing properly. I have tried using flush_rewrite_rules(); and flush_rewrite_rules(true);. I have also tried globalizing $wp_rewrite using $wp_rewrite->flush_rules(); and $wp_rewrite->flush_rules(true); Neither of which appear to be flushing the rewrite rules correctly. Those calls are indeed flushing the rewrite rules when called. How do […]

How do I get the permalink of a custom post type?

I can get the permalink of a specific post tag or category, but what if I want to get the permalink of a custom post type? I can’t find anything in the Codex or anywhere else about how to do this.

Add .html (dot HTML) extension to custom post types

Is there any way to add the .html extension to custom post types without plugin ? For posts I can use /%postname.html on the permalink settings For pages I can use: add_action(‘init’, ‘change_page_permalink’, -1); function change_page_permalink() { global $wp_rewrite; if ( strstr($wp_rewrite->get_page_permastruct(), ‘.html’) != ‘.html’ ) $wp_rewrite->page_structure = $wp_rewrite->page_structure . ‘.html’; } For Custom post […]

Shouldn't this be easy?! Custom post type/custom taxonomy permalink

So this is driving me absolutely insane. I’ve spend days trying to fix this and I can’t work out why this is so difficult as surely this is a very common permalink structure! I looked through hundreds of answers and posts and none of them seem to solve the problem. I simply want this structure: […]

How do I append multiple taxonomies to the URL?

Multiple taxonomies in URL How does one append multiple taxonomies to the URL having the following: Post Type: products Taxonomy: product_type Taxonomy: product_brand Adding new product and selecting type and brand for this product: When adding a new product, there are two taxonomy boxes (product_type and product_brand). Let’s call this new post Test Product 1. […]