When calling get_post_types()
in my plugin, I used it with
array( 'exclude_from_search' => false )
or
array( 'exclude_from_search' => false, 'public' => true )
but both of these include attachments, even though the front end search does not find an attachment.
If I use
array( 'exclude_from_search' => false, 'publicly_queryable' => true )
it does not include pages.
I thought to use 'show_in_nav_menus' => true
, but the site I’m testing on happens to have a custom post type that I want searchable but not in the menus.
Trying 'query_var' => true
, posts and pages are not returned.
I think 'has_archive'
is similar (in that it could be boolean or string), but it won’t show pages.
What do you think? Should I use the first one and remove attachment from the array? Is there something I missed?