#StackBounty: #custom-post-types #permalinks 'publicly_queryable' => false not working as expected for custom post_type

Bounty: 50

I have a custom post_type that I registered with the following settings:

  'labels' => piklist('post_type_labels', 'Tattooer')
  ,'title' => __('Enter the name of the tattooer')
  ,'supports' => array(
    'title',
    'editor',
    'thumbnail',
    'page-attributes'
  )
  ,'public' => true
  ,'has_archive' => true
  ,'rewrite' => array(
    'slug' => 'tattooer'
  )
  ,'publicly_queryable' => false
  ,'capability_type' => 'post'
  ,'edit_columns' => array(
    'title' => __('Name')
  )
  ,'hide_meta_box' => array(
    'author'
  )

I don’t want any URLs to single tattooer posts. My understanding is that 'publicly_queryable' => false is the tool for this job. But when I set it to false, the single URL is still active (Ex: /tattooer/foobar/) but redirects to the homepage. I think the intended behavior is that it should be a 404, which is what I want. What am I missing?

Notice that I’m using the wonderful Piklist plugin to expedite the registration of custom post_type(s), but I’ve tested without it as well and the results were the same.

My information is based on the documentation and this very similar question.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.