Ignores post types with 'public' => fase, 'has_archive' => true
mrwweb opened this issue · comments
I see that the plugin queries public not-built-in post types. However, in my current project, I'm using a private post type that will have an archive. (I don't think it's too hard to think of relevant use-cases for this: Anything where individual posts don't warrant a webpage but listing them all together does. Using 'public' => false
prevents the "View Post" links which is my primary motivation for setting that.)
I see a lot of possible solutions but I'm not sure which is best:
- Query for
'has_archive' => true
. Since the default is false, this might be sufficient. - Allow a developer to filter the
$post_types
the plugin uses. - Allow a developer to filter the
get_post_type()
I would lean toward option 3 (and maybe pass the $args
as a parameter so both 2 and 3 are possible with that filter) but I'd love to hear other thoughts. It seems like a straight-forward way to make the plugin more flexible without changing too much for the out-of-the-box users.
Ok. Looks like I spoke a little too soon. WordPress can't make a post type archive with public => false. So my use case isn't workable and I need to find another way to handle it.
However, I'll leave this open as I still think it might be worthwhile to let the $post_types
get filtered.
Hey @mrwweb - yup only 'public' post types can have archive. Agree on filtering the post types - will add this...
Sounds good. Since the default for has_archive
is false
, does it make sense to only show public non-built-in post types with 'has_archive' => true
?
Are you suggesting changing the query to 'has_archive'=>true
instead of 'public'=>true
(in case a public post type doesn't have an archive)?
That's the thought. I think the has_archive must be true for the plugin to
be useful for a post type. But I might be overlooking something.
On Tue, Jun 25, 2013 at 5:17 PM, Stephen Harris notifications@github.comwrote:
Are you suggesting changing the query to 'has_archive'=>true instead of
'public'=>true (in case a public post type doesn't have an archive)?—
Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-20018560
.
Fixed with 1.2. Thanks!