You forgot the meta_query
key in your $args
.
$meta_query = array(
'relation' => 'OR',
array(
'key' => 'tic_assignment',
'value' => $current_user -> ID,
'compare' => '=',
),
array(
'key' => 'tic_department',
'value' => $_depts,
'compare' => 'LIKE',
),
);
$_args = array ( 'post_type' => 'tickets',
'meta_query' => $meta_query,
'posts_per_page' => 10,
'orderby' => 'date',
'order' => 'DESC', );
$the_query = new WP_Query( $_args );
Related Posts:
- WP_Query orderby custom field then post_date in one query
- Filtering a WP_Query meta_query by numeric values isn’t working
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- Filtering by Post Meta Custom Fields – Performance
- WP_Query: include custom post type only with specific meta value
- Returning a list of custom post types excluding those without a specific meta_value
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- wp_query check if integer exists in custom field’s array
- Possible to filter custom post type with multiple meta data?
- Query based on custom fields start and end date
- Getting a custom post’s custom field based on another custom post’s custom field select
- meta query multiple values for the same key
- Sort custom post archives by a meta value from a different custom post type?
- Custom post types – meta_query: search lesson which starts sooner
- Query events post type after current date and timezone
- Selecting posts older than the current Unix epoch timestamp
- Querying meta values within an array
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- WP_Query() show posts that end later than today
- Search multiple custom fields by using meta_query
- Sorting a query by custom field date
- How can I generate a RSS feed based on a custom WP_Query?
- Search Custom Post Type with all meta attached?
- order by meta_value serialized array
- How to sort CPT by custom meta value (date), and return posts month by month
- WP_Query on custom post type not displaying, multiple loops & get_template_part
- Combine tax_query and meta_query in WP_Query
- How loop through posts based on custom fields
- Filter posts with meta_query NOT IN where value has multiple values
- Sort by two dates. Default entry date and custom field if present
- Display custom post types with custom date field value (before today) & order by custom date field
- wp_query to find posts by year and month
- Get all Posts If has same custom field values in Posts
- meta_query compare >= not working but
- Including Custom Meta with posts_where query
- Filtering custom post type on a combination of custom taxonomies and custom fields?
- How can I get the number of custom post type posts that have a specific attachment image set?
- Problem querying Custom post type by custom fields
- Orderby CPT custom fields not working
- Query custom post type with ACF Date
- Stuck in Order by more then one
- Meta Query Filtering not working on Custom Meta Box using Radio Buttons
- Including metaboxes from custom post types in global search — continued
- Query Multiple Custom Posts by Custom Fields
- Order Custom Post Type by Custom Field Value
- Meta Query posts not showing on ending date of custom field
- Admin Custom Meta Box – Pull Last 5 Posts from Custom Post Type
- Configuring a meta query with multiple post types that have the same relationship on a single page
- How to Output which matched meta_keys were found from custom_type_posts?
- How to let users choose where to search for posts?
- DIsplaying URL of custom field in last post of certain taxonomy && post type
- WP Query ‘posts_per_page’
- How to get specific post meta by title or id
- WP_Query orderby not work with meta_key
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- find custom post type post by searching its custom field with my string
- WP_Query of custom post type sorted by meta_key has unexpected results
- Custom Query: If One Post Object Field Value Is The Same As Another
- Custom Post type loop with ACF not displaying properly
- Create a WP_Query where if the first value of the first row is equal to the second compare other value
- Sorting by meta_key different to search criteria?
- Using WP meta query to show custom post types by a start and finish date
- Cache issue with WP_Query and custom field filtering
- How do I list a custom field and custom taxonomies for each result in a loop?
- order the meta query results by 2 custom fields
- Custom Form / Search with Custom Post Type Data
- Alike Shortcode using in Custom Shortcode
- Query custom post type that has a serialized relational advanced custom field value
- Sort custom post column by generated value?
- build child and anchestor three from post parent
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- meta query condition don’t work
- How can I query and sort custom-post type using WP_Query
- Custom query result empty on page 2
- Meta query and compare “!=” not working as expected
- Use WP_query to match post types based on custom field values
- Filter posts by their related field’s custom field
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- Query a Custom Post Type using SELECT that has ACF fields to compare dates
- Post Filtered by Custom Field Value
- Filter custom WP_Query by first letter of a custom field – hopefully using Search and Filter Pro?
- sorting in wp query based on custom field value
- WordPress loop add heading before first of type
- How to make a shortcode for my WP_Query Loop? [duplicate]
- Conditional posts in WP_query for search
- Calling specific page with wp query
- How to stop wp_query searching pages as well as the specified CPT
- Unable to get the upcoming events for custom post
- WP_Query and two custom fields returns no posts
- Storing/querying custom date data
- Trying to combine multiple WordPress queries
- 404 on Pages for Custom Post Type & Query_Posts
- WP_Query arguments: Loop through custom post type – get all entries except excluded meta_key?
- Show Posts in Vertical Tabs with Scrollbar
- How to show all posts of specific custom post type with their custom fields values?
- Check for custom field value in different post type than current one and do something
- querying to custom field over ACF REST API
- Order Wp Query by earliest of 3 dates meta query
- WP Query + custom fields: How to query event posts from the current date backwards 6 months and organize it month by month?