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
- Get post with multiple meta keys and value
- Get posts for custom post type with WP_Query
- Number of pages – multiple (custom) post types
- Enforcing canonical URLs with multiple custom post types
- WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)
- Get latest 4 post on a custom post filtered by category
- how to group custom post type posts by custom taxonomy terms
- wp_query and comment_parent – select only posts with top level comments
- List all custom post type posts from a given category?
- Automatically adding meta data to posts or multiple query help
- Loop on front-page.php
- Custom Post Types not showing, custom WP_Query
- Pagination : How to remove /page/x/ after a ‘POST’ action on a form returning to page 1
- Can I create a loop with multiple post types and specify different $args for each post type?
- Display custom post type from dynamic custom field
- Previous/Next Link by Meta Value in CPT
- Limit amount of posts made within a custom taxonomy
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- How do you paginate a query grouped by month?
- Query Custom Post Type Taxonomy term with multiple parameters
- pagination not working for category.php (custom post types in categories)
- Why is my WP Query not returning first result’s post meta?
- Different Limit number of post on different archive page
- WP_Query Custom Post Type if Category ID Equals
- Custom post types and ‘new WP_Query’
- Query Custom Post Types with checkboxes
- Select2 AJAX and WP Query Returns ALL and does not filter
- WP_Query orderby not work with meta_key
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- Dynamic pages for linked categories and content
- Searching post types
- How to retrive Custom Post Type Meta Fields in Custom WP_Query
- wp_query not returning my custom post
- Get next and prev item from custom WP_Query and Custom Post Type
- After inserting new post with wp_insert_post() the post is not visble to WP_Query, but the same WP_Query works for post inserted from wp-admin panel
- WP_Query: how to search tags in addition to a custom post type?
- Pagination Not Working When Used With WP_Query() `offset` Property
- Help understand and create a loop with WP_query
- Search result based on URL
- Shortcode in excerpt
- How to query custom post then display sections by meta value
- Using tax_query to get single post per category
- Show Posts in Vertical Tabs with Scrollbar
- How to manage wordpress knowledge base/wiki/posts collections
- Can I add a wordpress page using the slug for a CPT rewrite