Because when registering your post type you have 'exclude_from_search' => true
get_posts()
is just passing that to WP_Query
. In the parameter definitions for WP_Query
it states:
‘any’ – retrieves any type except revisions and types with ‘exclude_from_search’ set to true.
Related Posts:
- How to put custom post types on front page
- How to set a custom post type post as static front page?
- Should I use custom post types for a front page video feature (vimeo)?
- Loop on front-page.php
- Custom Post type with ACF in REST API, how do I get those values?
- WordPress Ignoring My Custom Post Type Templates?
- Warning after create Custom post type with Roots theme
- How to set up Custom Post Type archive page as Front page
- How to conditionally add Custom Post Type to Front Page
- Custom pages missing on “front page” setting
- Make pagination work as a carousel (custom query)
- List posts of custom post type under category name
- When I select a page for frontpage, it is blank
- Static front page has page url not site url
- Get posts in same category not working
- New WP_Query not isolating custom post types on front-page template
- Roots: Custom Post Type 404 Not Found [duplicate]
- Show custom category archive as front page and remove taxonomy slug from urls
- How to get post content by calling ajax?
- How to properly turn off REVISIONS and AUTOSAVE for whole site and optionally for a custom post type only
- Order by & include array by specific post ids
- How to remove /blog/ prefix for custom post types in permalinks?
- Limit widget to a specific registered sidebar
- Restrict a Post Types Post Status
- WP_List_Table Inside Metabox Not Working on Submit
- Customize users’ capabilities to change a custom post’s post status
- wp_generate_attachment_metadata gives me an empty array
- Comparing timestamps in meta query doesn’t work
- Possible to add meta box to edit.php pages?
- Is there any performance consideration when using Custom Post Types?
- Automatically adding meta data to posts or multiple query help
- Make Custom Post Behave Like Normal Post?
- Conditionally Query Custom Post Types by Post Meta for Blog Home Page?
- Output the content of a term organised by each of the CPT?
- How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
- Generate Shortcodes by Taxonomy
- Loading all files within a directory
- Pagination is not working on single-{slug}.php but works fine on page-{slug}.php
- Change or update WordPress loop based on dropdown selection
- How does one customize the table of listings for a custom post type?
- Add a tag to a custom post type
- I have 2 post types i need to show the post type contents in 2 select boxes [closed]
- Add an option in a builder
- Trigger email send after custom post publish
- What is the best way to correlate one-to-many content-type relationships?
- Is there a conditional tag to determine whether the post is _any_ custom post type?
- Add field to all custom post types
- Single template showing all posts of that type
- Cluster CPT posts to users based on ACF value from their profile on dashboard
- Shortcode not working with post counter
- How can you use one database with multisite
- Admin Custom Meta Box – Pull Last 5 Posts from Custom Post Type
- List Taxonomies: Don’t list taxonomy if it has no post – depending on custom post-meta?
- Target post type edit page to change view post button, how do I?
- How to let users choose where to search for posts?
- Including link to custom post type in ‘wp_list_pages’ function
- Creating tags via API
- Custom post types or not custom post types?
- WP_Query Custom Post Type if Category ID Equals
- Saving Meta Data within Custom Post Type
- Select2 AJAX and WP Query Returns ALL and does not filter
- Can’t delete a custom post in front end with custom role
- Show categories of custom post type and not all posts
- Reusable metabox backend and frontend
- How to loop through custom post type items and add them to a slider if they exist
- Meta box data not saving
- Custom post type (Jigoshop): unexpected value for $category_id (via $term->term_taxonomy_id) on live server
- custom comment fields on CPT
- Pagination does not work on Custom Post Type archive while trying to get load more function working
- Use Gravity Forms and a Shopping Cart for output to Freshbooks for an Estimate [closed]
- Displaying taxonomies as category links within sidebar and creating pages for these
- Can I bind a post_type=’post’ category to a custom post_type category?
- How to exclude categories from a sidebar with active widgets in it?
- Display the link of a custom taxonomy
- Add custom posts to submenu automatically
- Hide Published text from custom post types column
- Fetching custom post type without knowing post type (REST API)
- Custom taxonomy: on the taxonomy term page show other taxonomy terms
- Get next and prev item from custom WP_Query and Custom Post Type
- wp_set_object_terms creates taxonomies but does not add custom posts to it
- Make bootstrap 5.0 carousel dynamic using ACF and CPT UI [closed]
- Custom post categories are not displaying on the page
- Pagination Not Working When Used With WP_Query() `offset` Property
- get_posts wont produce a list of custom type from a given category [duplicate]
- How to create editable sections in wordpress?
- Adding categories to custom post type in permalink
- Get posts under custom taxonomy and custom post type
- Flush rewrite rules when new cpt is registred
- Shortcode in excerpt
- Custom field linking problem!
- Remove custom post type generated by a plugin (The Events Calendar) [closed]
- Show custom taxonomy not in submenu
- Custom Post Type and Custom Taxonomy not connected
- How to Associate Posts with Pages
- URL Rewrite Adjustment for Custom Post Type causes template to revert to index.php
- Custom post type rewrite with_front
- How do I display the index position of a post from a custom post type?
- how to show Author post type count
- What is the code for showing Custom Category and Subcategory Page?
- Same slug for Custom Taxonomy archive and CPT archive – Rewrite rule not working