0

I wrote a plugin for WP.org that uses a custom post type with the slug "reading-list" and I cannot view mysite.com/reading-list/ when I have either the "default" or "numeric" permalinks setting in wp-admin.

Does anyone know why this would be, i.e. why it only affects these two settings?

I use flush_rewrite_rules() after registering the custom post type in the plugin and I checked all of the parameters according to the Codex but nothing seems to help.

Thanks.

1 Answer 1

1

The URL you are trying to access-- mysite.com/reading-list/-- is constructed by the WordPress rewrite rules. The path /reading-list/ doesn't actually exist. If you are using the default ?p=123 links, those rewrite rules are not used. The default links are just GET strings.

In other words, since there is nothing at mysite.com/reading-list/ without the rewrite rules you get a 404.

Without the rewrite rules, you need to access the content using vanilla GET syntax. For example, the "Book" post type used in the Codex as an example...

function codex_custom_init() {
    $args = array(
      'public' => true,
      'label'  => 'Books'
    );
    register_post_type( 'book', $args );
}
add_action( 'init', 'codex_custom_init' );

... is accessed without rewriting as ?book=book-cpt-post-title. You can't switch off rewriting and also have that non-existent /reading-list/ directory, though you could create a "Page" called reading-list and use that to display your CPT.

2
  • That is what I was thinking. So is there any way to fix this or work around it? Sep 27, 2013 at 12:40
  • @MikeStumpf : see the edit
    – s_ha_dum
    Sep 27, 2013 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.