I created a one page style website that I converted to WordPress. The website include a blog, but I'm not using the usual WordPress way to display the post as I'm using a modal window appearing on click to displaying it. So basically I'm not using the Pages/Posts/Comments admin sections at all. Instead I decided to go with custom post types and create my own PHP loops. This is working pretty great for now.

But I have a problem with permalinks. Everytime I want to create a CPT, there's a permalink attributed to the "post". For example here's my CPT settings for a "carousel logo display" section (I use CPT UI plugin to create my CPTs, saying it just in case) :

    "labels" => $labels,
    "description" => "",
    "public" => false,
    "publicly_queryable" => true,
    "show_ui" => true,
    "delete_with_user" => false,
    "show_in_rest" => true,
    "rest_base" => "",
    "rest_controller_class" => "WP_REST_Posts_Controller",
    "has_archive" => false,
    "show_in_menu" => true,
    "show_in_nav_menus" => false,
    "exclude_from_search" => true,
    "capability_type" => "post",
    "map_meta_cap" => true,
    "hierarchical" => false,
    "rewrite" => false,
    "query_var" => false,

Which is working in a way. I mean that I don't have that mywebsite.com/CPT_Name/blablabla/ type of links anymore. But I still have something like mywebsite.com/?post_type=CPT_Name&p=43 working instead (displaying my homepage), which is scary in a way.
I don't care if anyone goes on these links, because there is 0,1% of chance it happens (as of course I'll not publish/use these links at all). But I'm scared that Search engines get these permalinks in their database.

So basically, am I doing CPT the good way ? Do permalinks like the one I talked just before risks to appear on search engines ? Do I need to redirect these permalinks to my 404 page ?

Thanks a lot !

1 Answer 1


I think you should be able to set publicly_queryable to false, which should prevent those ugly permalinks from being generated / working.

  • Thank you very much ! This was indeed the last option I needed to disable to finally block all the CPTs permalinks.
    – Rojiraan
    Apr 15, 2019 at 17:44

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.