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
- Custom post type RSS feed, multiple post published on same day bug
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- Displaying custom field according to date
- How to display author post count for multiple custom post types?
- Creat new admin url for custom post type
- Extracting Address from Custom Post via Javascript for Google Maps API
- Custom Post Types — $args vs. labels array
- custom post for slider
- Multiple pages per post (not pagination)
- Confused about Custom Post Types
- Sortable column containing numeric values for Custom Post Type at WordPress Backend
- Listing all post from different custom post type for the logged in user
- looping though custom post types and only return results in a given taxonomy
- custom fields cannt be seen with version 3.1
- Unable to edit categories in custom post type
- Creating shortcode id for custom post types
- Pagination on search results page
- Custom Taxonomy Template file not being used
- Sanitize title only if only custom post type
- Best way to create a search for custom post type by custom field values
- Taxonomy rewrite pagination 404
- WordPress post carousel
- Need to return a string as permalink insted of str_replace
- Custom Content Type with No Page View
- Custom types, taxonomies and query optimization
- How can I implement jQuery plugin correctly with my CPT?
- Retrieve Custom Taxonomies with Description and Slug
- How to list posts by term (custom taxonomy)
- How to setup different permlalinks for posts and pages?
- Query custom posts from custom taxonomy
- Excerpt length: get first paragraph
- Problem Saving Custom Post Type Meta Values
- How can i loop through custom post type according to custom meta field?
- Change ordering of fields of custom post type in admin page
- WordPress/Javascript form not working on custom post type single posts
- Random item on Custom Query working Local but not on live
- I’m having trouble with Related Product “tax_query” ‘terms’ value
- Display category filters for custom post type when category is shared by multiple post types
- How to add field to custom post type endpoint
- meta_query Where the key value is stored as an array
- How to set “section categories”?
- Get all posts by many custom post types
- What’s the best way to do this: inquiry/ticket system?
- wp_editor in custom post type is not saving formatted text like bold, italic etc
- Custom Post Type has wrong label and is not found when called by a loop
- Rewrite URL of Specific Post of Custom Type
- custom data model – link and populate from admin backend
- Page + Custom Post Type with same category
- Best way to have one product in both rental and sale parent category
- How do I display specific custom posts, and how do I edit a post’s singular page?
- WP_posts (Not meta) extra custom field column show and change it in a custom post type
- CPT not entering jQuery ready state
- how to make custom post with “publish” default functionality not save in draft?
- Unexpected behavior from custom taxonomies
- Custom Post Type Rewrite – Page Not Found
- wp_query return nothing
- How can I include custom post types on a tag page?
- How can I convert custom posts types into regular posts?
- How to add gallery support to a custom post type?
- WordPress: insert a custom post type instance as an option for a custom taxonomy
- WPAlchemy Metabox rewriting slug
- Archive templates based on taxonomies
- Pagination URL order
- Return all wordpress custom posts in specific multidimensional array
- Hierarchy between post types
- Top 30 Songs using Custom Post Type
- direct custom post query interferes with other queries on page
- Reservations as Post
- show 10 most recent custom post types excluding the one(s) from specific custom taxonomy
- add a “list” into add meta box : problem
- display custom post type from register taxonomy
- Page templates for custom post types
- how to display custom taxonomies in front page
- Elementor Custom Query to get Posts by ACF (Post Object Field
- Make term slugs of custom taxonomy available in WP REST API for custom post type?
- Made a Custom Post Type using ACF. Via the dashboard I cannot see the view button to see the post
- Multiple search forms and respective results page templates?
- Remove date rewrite rule for custom post type archive page
- How to get Custom Post Type (CPT) Archive Page’s Posts Featured Images Preload in header.php
- remove pagination from a single blog entry
- How do I edit this code so that it also adds specific meta data into the user and subsequent CPT being created?
- Display content based on multiple URL parameters—pretty URL or query string