Articles of permalinks

Custom post type hierarchical permalinks not behaving as expected for parent/child pages

When you have Pages with children, the permalink structure works something like this: All well and good. Trying to go to this URL: doesn’t work, which is good, and as expected – I only want the one URL for my child page. However, I’ve set up a custom post type, and set it […]

Changes to permalink structure results in 404 error for all pages other than home

When changing the permalink structure on my site, I get a 404 error for every page except the home page. I’ve see other questions that mention resetting the permalink structure to get it work, but this doesn’t work for me (using the default of ?p=123 does show the posts, but changing back to month and […]

Extend the wp_get_archives output with '?post_type=foo'?

I’ve gotten my custom post types to display as it should in date based archives; the structure (and above) works properly as long as it’s extended with ‘?post_type=post_type_name’. With Bainternets solution I’ve also gotten wp_get_archives to properly list archives based on whether or not they contain my CPT. The problem is that wp_get_archives still […]

Custom rewrite rules for a $_GET request

Assuming I have this URL: How can I change it to a nice URL that looks like: using WP’s URL rewriting system?

Using only %postname%

So I see everyone’s arguements against using this, but that seems like a huge flaw in WordPress because a domain name as close to the root is crucial to a site’s SEO. I want my site which has rough 8 pages total to be able to be found by their simple titles, if they’re preprended […]

Getting links to work the same on development and production

I am working on a website where I am specifying links to pages within my site in other pages. I am using the same permalink post name structure i.e. on both development and production and I am using /index.php/sample-post/ to link to a specific blog. This works on production but not on development. My […]

Can't get rewrite rules working

Basically I want to rewrite: /edit/test-post to an existing page with a parameter: /edit?e=test-post From the examples in the Codex I created: add_filter( ‘rewrite_rules_array’,’my_insert_rewrite_rules’ ); add_filter( ‘query_vars’,’my_insert_query_vars’ ); add_action( ‘wp_loaded’,’my_flush_rules’ ); // flush_rules() if our rules are not yet included function my_flush_rules(){ $rules = get_option( ‘rewrite_rules’ ); if ( ! isset( $rules[‘(edit)/(\d*)$’] ) ) { […]

Custom permalink with pagination

I have a custom post type called news and in order to distinguish current and old news posts I have a custom field where the client can mark a news post as ‘archived‘. So my permalink rewrite code looks like this: function custom_rewrite_rule() { add_rewrite_rule(‘^news/archive/?’,’index.php?post_type=news‌​&news_archive=true’,‌​’top’); add_rewrite_rule(‘^news/archive/page/([0-9]+)?/?$’,’index.php?post_type=news&news_archive=true&paged=$matches[1]’,’top’); } add_action(‘init’, ‘custom_rewrite_rule’, 10, 0); function add_query_vars_filter( $vars ){ […]

Permalinks for custom post-types within custom taxonomies not found

I have tried to apply the advice offered by TheDeadMedic in this post to achieve the following URL structure: = a WP page = a custom archive = a custom post All URL’s work until the lowest one which returns a WordPress “not found” error. I don’t know whether I need to […]

Custom post type's get_permalink returns wrong url

Currently my permalink setting is /paper/%postname%/. I am developing a plugin, so the following is done during the activation. I am programatically adding a new custom-post-type called ‘meta’, like this (at ‘init’): register_post_type( POST_TYPE, array( ‘labels’ => array(‘menu_name’ => ‘meta’), ‘public’ => true, ‘rewrite’ => array(‘with_front’=>false,’slug’=>’meta’,’pages’=>false) ) ); Then in the activation I programatically added […]