Skip Navigation

[Resolved] Disable query_var?

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

Problem:
The issue here is that the user disabled query_var for their cpt however a url parameter like this post_type=test still results in the CPT being displayed

Solution:
I've found some discrepancy in the way this is described. The query_var attribute does not disable this type of query as our document states.

In our document it gives the example "mysite.com/?post_type=example" which is incorrect. What this attribute is meant to disable is querying for a post in that post type using the post's slug, example "example.com/?book=life-of-pi" where book is the post type and life-of-pi is the slug of the single post.

This support ticket is created 5 years, 11 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Kostas 5 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#1163030

I am trying to: disable cpt listing.

Link to a page where the issue can be seen: hidden link

I expected to see: a 404 error page, or similar.

Instead, I got: sample cpt listing.

#1163036

Please also note that has_archive option is disabled.

Thank you,
Kostas

#1163078

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kostas,

I was able to verify this issue and created a ticket with our 2nd tier supporters for review.

Thanks,
Shane

#1165590

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kostas,

I'm still in discussion with our second tier supporters on this one.

In particular the query_var as based on the wording of of the setting in our plugin it should disable the query to access the archive.

#1182430

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kostas,

Are you still having issues with this ?

Thanks,
Shane

#1182447

Hi Shane,

Yes, nothing has changed since our last talk.

Regards,
Kostas

#1183626

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kostas,

I did some tests on this for you and i've found some discrepancy in the way this is described. The query_var attribute does not disable this type of query as our document states.

In our document it gives the example "mysite.com/?post_type=example" which is incorrect. What this attribute is meant to disable is querying for a post in that post type using the post's slug, example "example.com/?book=life-of-pi" where book is the post type and life-of-pi is the slug of the single post.

Is it that you want to remove this post type from being seen on your site? If so then what you need to do is disable the publicly_queryable attribute.

Please let me know if this helps and I must apologize for the lengthy delay in getting back to you on this.

Thanks,
Shane

#1183671

Ah, OK then, thank you Shane!

Please correct your documents mentioning the example you have just given ("example.com/?book=life-of-pi")

My issue is resolved now. Thank you!

Cheers,
Kostas