You may find that you need to hide a custom post types single or archive pages or even both in WordPress. This may be the case if you are outputting a custom loop of cpts and don’t want duplicate content or discoverable pages which you don’t want published.

View the code on Gist.

In the above gist in the $args, ‘has_archive‘ is set to false which hides the archive pages and publicly_queryable is also set to false which hides the single pages.

Make sure to flush permalinks after and these pages will no longer be visible.


Leave a Reply