Skip Navigation

[Resolved] How to I disable the single page for a post type?

This thread is resolved. Here is a description of the problem and solution.

Problem:

I want to disable the single pages for this post type so that trying to access the urls for each individual post in the account managers post type will simply return a 404.

I've unchecked the "has archive" and "Pages" options in the Account Mangers post type options but the individual pages still show.

Are you able to tell me how to disable these single pages from being displayed?

Solution:

I suggest you edit the post type, in section "Options", disable option "publicly_queryable", it will disable the single "Account Manager" post in front-end. More help:

https://codex.wordpress.org/Function_Reference/register_post_type#publicly_queryable

publicly_queryable

(boolean) (optional) Whether queries can be performed on the front end as part of parse_request().

Relevant Documentation:

https://codex.wordpress.org/Function_Reference/register_post_type#publicly_queryable

This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 6 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#619519

I have an "Account Manager"s post type on a development site that lists staff members and displays them on a map page here:

hidden link

I have noticed that if I directly access the page slug for each account manager that I can view an unstyled single page, for example:

hidden link

I want to disable the single pages for this post type so that trying to access the urls for each individual post in the account managers post type will simply return a 404.

I've unchecked the "has archive" and "Pages" options in the Account Mangers post type options but the individual pages still show.

Are you able to tell me how to disable these single pages from being displayed?

Thanks in advance,

Phill

#619603

Dear Phill,

I suggest you edit the post type "Account Manager", in section "Options", disable option "publicly_queryable", it will disable the single "Account Manager" post in front-end. More help:
https://codex.wordpress.org/Function_Reference/register_post_type#publicly_queryable

publicly_queryable
(boolean) (optional) Whether queries can be performed on the front end as part of parse_request().

#620699

Thank you - that worked perfectly!

#620774

You are welcome