Skip Navigation

[Resolved] How to hide posts connecting two different custom post types?

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.

This topic contains 2 replies, has 2 voices.

Last updated by hossamH-2 4 years, 3 months ago.

Assigned support staff: Nigel.

Author
Posts
#531182

It's a very urgent question but very simple too..

I have two CPTs X and Y having a many-to-many relationship through a 3rd Z CPT that is nothing but a virtual link between X and Y. Every post in Z should naturally be a link between a post of type X and a post of type Y.

Now, how can I hide these posts (or the CPT itself) from being accessed on the frontend? If I set those posts to private, the two X and Y CPTs - to my surprise - don't become accessible. Setting them to password protected still get them publicly accessible URLs, so this is not a solution neither.

Even if I decided to use the ACCESS plugin to set this CPT access level, it would still be accessible on the fronted but requiring a login or something, so this is not working too.

There must be a lot of folks here who needed to link two CPTs using something that they don't want it publicly accessible. How to hide that?

Thanks in advance,
Hossam

#531270

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Hossam

I'm not sure what the problem with using Access is.

If you manage the intermediary custom post type with Access and deny read access to guests then users who are not logged in will by default see a 404 page not found error, and if you have logged-in users who you do not want to see these posts then for their role you would also deny read access.

Have you tested it and found something different?

#531684

Thanks for your reply, Nigel. I have found out that there is a property "public available" when editing the post type; when unchecked it does the job. There is no need to use Access plugin or any additional plugins.

Regarding using Access, I assumed that non logged-in users will get 401 unauthorized instead of 404, but I was wrong. Thanks though.