I use a custom post type in one of my sites for image slideshows. I have publicly queryable set to false/off but when Google crawls my site I see 404 errors for the URLs for my slideshows. I thought that by having publicly queryable off Wordpress would not create those front end URLs.

How can I completely turn off the front end URLs and pages for my custom post type?


By adding 'public' => false, 'has_archive' => false, 'publicly_queryable' => false, and 'query_var' => false I have successfully gotten rid of the 404 errors in Google. I also added the function provided by @Norcross just for good measure.

  • What is your URL?
    – s_ha_dum
    Commented Dec 1, 2012 at 15:41
  • how do you edit the custom post types with those settings? Public false means I cant edit it in admin Commented Mar 4, 2016 at 14:46
  • 1
    To edit in the admin looks like you need public => true, then you have a typo to make it not visible on the front end, it should be publicly_queryable Commented Mar 4, 2016 at 14:50
  • !!!! Attention !!! There is a typo it should be 'publicly_queryable' not 'publicaly_queryable'
    – Tofandel
    Commented Aug 6, 2018 at 14:49

4 Answers 4


Another option would be to set a 301 redirect for all the slideshow CPTs to redirect somewhere (like the home page). This would get picked up by Google, and also make sure no one accidentally gets on them

function rkv_slideshow_redirect() {
    global $wp_query;

    // redirect from 'slideshow' CPT to home page
    if ( is_post_type_archive('CPT_NAME_HERE') || is_singular('CPT_NAME_HERE') ) :
        $url   = get_bloginfo('url');

        wp_redirect( esc_url_raw( $url ), 301 );

add_action ( 'template_redirect', 'rkv_slideshow_redirect', 1);
  • Thanks! All of my slideshow 404 errors in Google are now gone. I added public => false, has_archive => false and publicly_queryable => false and they no longer show up as 404 errors. I did add the code you provided to my functions.php file "just in case". Thanks again!
    – dkmojo
    Commented Dec 3, 2012 at 17:36

Apparently your slideshow, not WordPress, it revealing those URLs. I assume it is wrapping the images in the slideshow with links to the custom posts, which you don't want. You need to edit the slideshow so that it doesn't do that.

  • The slideshow uses wp_get_attachment_image_src to pull in the images within a loop so there is no link to the slideshow custom post type. I did just set the "public" parameter in my register custom post type method to false. I'll see if that helps. Thanks for your input!
    – dkmojo
    Commented Dec 1, 2012 at 15:39

A modification to your original question, you should add

'exclude_from_search' => true,

If this is not added, the CPT will show up in search results.


Please Flash or change permalink and save. Dashboard -> Setting -> permalinks -> Change Or flash Then Save setting.

  • I'm not sure that would help here? I don't think WordPress uses the permalink cache to actually create URLs, only route them.
    – Rup
    Commented Jun 23, 2021 at 23:08

Your Answer

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

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