Instead of creating a string try creating an array and check.
$posttypes_array = array();
foreach ($post_types as $post_type ) {
$posttypes_array[] = $post_type;
}
And then form the query as follows
$buildArgsAllQuestions = array( // Add out new query parameters
'post_type' => $posttypes_array,
//'post_type' => $posttypes_array,
'orderby' => 'date',
'order' => 'DESC',
);
Related Posts:
- How to use a custom post type as front page?
- WP_Query ignores post_type in category view
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- Querying Posts by Taxonomy From Alternate Network Site
- Query by 2 values of a repeater ACF field
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- Include both default and Custom Post Type in query modified inside pre_get_posts
- Having trouble with custom date field for CPT query (WordPress)
- WP_Query search posts by custom post type and custom taxonomy
- Calculating Bayesian average for custom post type
- Conditional to modify query results
- Multiple post type queries (with specific arguments for each)
- Is it possible to create a shortcode that will query a post based on taxonomies?
- Querying Term Posts in Loop
- WordPress Orderby Numeric Value Not Working
- WP_Query | ‘post_type’ doesn’t work
- convert custom query to wp_query
- Search / Filter posts on Title/Content OR Tags
- creat filter with wp_query
- First custom field value (out of several) displayed twice after query
- Prioritize posts in query by meta keys?
- WP_Query orderby and tax_query
- Different Ways to Query Custom Post Types?
- Showing specific post in order of array wp_query
- WP_Query() with custom post type and taxonomy — get all terms?
- Custom filter for main search: how to exclude specific post_type from search results
- Custom post type and standard post not displaying or working
- Returning a custom content types with meta values
- Create query for both custom post type and category
- Post Type => Any conundrum
- Query custom posts from custom taxonomy
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- 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
- How select query is generated in a Custom Post Type?
- WP_Query for custom taxonomies showing posts from non-specified terms?
- WP_Query with all posts in one custom post type and only posts in another custom post type with a specific category
- post type => ‘any’ not applied my custom queries
- Linking posts together with Advanced Custom Fields “both ways”
- Get posts of an specific term of a custom taxonomy
- Conditional posts in WP_query for search
- Query Pulling the same post twice
- Is it possible to add query parameters on the archive page?
- Query child posts on parents single.php?
- Query Posts From Multiple Post Types
- WordPress can only query up to 766
- How would I get a list of posts from a custom post type
- Why does ‘exclude_from_search’ exclude a custom post type from WP_Query?
- How to add post type in masonry posts elementory widget
- Filter Custom post type by another Custom post type
- Create a list of months based posts
- Quering array of post types & pagination. Articles are repeating sometimes on different pages
- Load posts via AJAX without draft status
- Query Multiple Post Types and Paginate Newly Created List
- Custom-Posttype & Custom Taxonomy WP_Query
- Crafting WP_Query array, sort by date
- Custom loop with multiple taxonomy queries
- Return one unique custom post type result when it shares a custom taxonomy in WP_QUERY?
- Get parse_query filter to return slug instead of id
- Converting the_content string to an array?
- forming WP_Query for posts of all post types but from specific categories
- Get latest 3 posts from multiple CPT in one query
- Loop to fetch 3 post_thumbnail instances from 3 most recent custom post types named “portfolio”
- Querying both pages and posts
- Display upcoming Events for next 7 Days
- Meta query for custom post type ignored in main query
- Isotope Filtering with Bootstrap Tabs – Custom Post Type Query Loop in each Tab (Have to click twice to filter)
- Custom post ui plugin & WP_Query – Polylang
- Querying Two Custom Post Types with OR Not Working
- How do I move/order posts with a tag to the end?
- How can I get the number of custom post type posts that have a specific attachment image set?
- How to use load more custom post type data normal or according to on click category tab In WP
- orderby rand is not working for a custom post types
- Problem querying Custom post type by custom fields
- How do I set default meta value by post type?
- Orderby CPT custom fields not working
- Custom taxonomy rewrite give pagination 404
- WP_Query order by custom field, then randomly order some of results
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Mixing 2 custom post types with posts output in specific pattern
- Custom post taxonomies as tax_query terms?
- Limit amount of posts made within a custom taxonomy
- Incorrect post_type in url of taxonomy term
- Troubles with acf/save_post and WP_Query
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- Query custom post type with ACF Date
- How to do WP_Query with two meta fields with orderby clause
- Stuck in Order by more then one
- Display featured image from one CPT within another CPT query
- Custom WP Query on custom meta and sort by multiple meta keys value
- Show only one post on custom post type archive
- Woocommerce search pagination not working
- How to order WP_Query by parent for hierarchical Custom Post Type?
- Including metaboxes from custom post types in global search — continued
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- How can I made custom taxonomies relationship?
- Query Multiple Custom Posts by Custom Fields
- What’s the WP way to load remaining custom posts?