add_action( 'pre_get_posts', 'add_my_post_types_to_query' );
function add_my_post_types_to_query( $query ) {
if ( is_home() && $query->is_main_query() )
$query->set( 'post_type', 'any' );
return $query;
}
refer to http://codex.wordpress.org/Class_Reference/WP_Query#Type_Parameters
Related Posts:
- Function to limit number of custom post types on homepage – TwentyTen
- Pagination not working with custom loop
- How do you use a CPT as the default home page?
- Get the ID of the latest post
- Sort custom post type list table by display name of a user id stored as post meta value
- How to use a custom post type as front page?
- Random post, once per day
- get attachments for all posts of particular post type
- Query custom post type by custom field
- Add Custom Post Type to Current Query
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Showing specific post in order of array wp_query
- Number of posts in the archive
- Query of custom post types only shows first post
- Custom query for custom post_type
- Adding custom field values to wp_list_pages
- Query multiple taxonomies with pre get posts
- How to query 2 custom post types that need to share a slug?
- Is it possible to show multiple (custom) post types at the wp homepage only by using pluging code?
- Query Custom Post Types with checkboxes
- WP_Query() with custom post type and taxonomy — get all terms?
- List of child custom post types lists all custom post types
- Query custom post type based on post id and custom field value
- Set a hard-coded page-template (post-type-archive) as home/front-page of my wordpress blog?
- Listing custom post types on archive page with array
- Make (custom) post type accessible only by custom query
- Can I query posts by taxonomy conditionally based on post type?
- How to conditionally add Custom Post Type to Front Page
- Graphql: Unable to query (where:{author}) for custom post type
- Query not work for current taxonomy
- Display a post from custom post type only if all the selected taxonomies and custom field value matches the record
- Returning a custom content types with meta values
- Custom Query: If One Post Object Field Value Is The Same As Another
- Break up posts per page in two sections
- Custom Post Type not showing in main loop
- Custom Post Type setup
- new WP_query > displays posts only once instead of running through full array
- Pagination on search results page
- Querying a custom post type, but not show duplicates
- Shortcode to return single custom post based on post taxonomy
- is_main_query() never called on WP 4.4
- Hide text if query has no posts
- How do I get the index for a custom post?
- Getting custom post types to properly display alphabetically
- Create query for both custom post type and category
- Filtering custom posts by custom fields (ACF) [closed]
- Setting a homepage – doesn’t seem to work
- Custom taxonomy query showing more than 4 posts
- Custom types, taxonomies and query optimization
- custom post creation on front page – on submit a search is done
- Query Custom Post by taxonomy multiple categories
- Query custom posts from custom taxonomy
- Custom Post type showing up in loop, regular posts are not showing up
- All in one calendar custom post type query doesnt work as expected
- Changing WordPress sort order for returned child pages
- Add custom post type to query
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- How to divide Subcategories into pages of parent category wordpress
- Update query based on CPT / Post Type, show all sorted by date
- Query filter by value in meta_value array
- Change search query in wordpress custom post type
- WP Query from two Custom Post type fields as statement
- WP Query: If field X is empty, show posts based on field Y
- Check that a slug is present in the get_terms request
- Display another page / custom post type as home page
- Using OR relation in meta_query to check for a value before sorting by another
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- Does this archive template part look like its making too many calls to the db?
- Shortcode with loop stacks output
- Displaying all posts by category and showing content on click
- WordPress custom post type as homepage with homepage url
- Meta query and compare “!=” not working as expected
- Creating a custom WP query for a Custom Post Type
- How select query is generated in a Custom Post Type?
- Custom Post Type Single Page and Archive Page redirects to Home Page
- Custom post type order by post_title
- WP_Query for custom taxonomies showing posts from non-specified terms?
- How do I query with multiple custom fields orderby in same column?
- How to hide sub fields in a field group and also the entire field group if the answer selected is “no”
- WP_Query with all posts in one custom post type and only posts in another custom post type with a specific category
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- post type => ‘any’ not applied my custom queries
- Custom post pagination not working
- Linking posts together with Advanced Custom Fields “both ways”
- Posts show up under “published” but not “all”
- How do I display specific custom posts, and how do I edit a post’s singular page?
- pagination for a custom query
- Get posts of an specific term of a custom taxonomy
- Show first posts with custom field not empty and order all by title
- Conditional posts in WP_query for search
- Display year value before a set of posts
- Help ordering custom query by Title, Ascending
- How to add parameters for custom post type
- Query Pulling the same post twice
- Custom Homepage As Single Page or Custom Post Type?
- Is it possible to add query parameters on the archive page?
- meta query always fails even if data is correct
- How to make post page unique and show it on home page?
- How do I get a nested query to only display content that the main query outputed
- $post breaking container loop