To select posts that have a meta value, use the EXISTS
comparison operator.
$args = array(
'post_type' => 'jobs',
'posts_per_page' => 12,
'paged'=> $paged,
'tax_query' => array(
array(
'taxonomy' => 'job_category',
'field' => 'slug',
'terms' => $term->slug,
)
),
'meta_query' => array(
array(
'key' => '_shop',
'compare' => 'EXISTS'
)
)
);
Related Posts:
- wp_query check if integer exists in custom field’s array
- WP_Query not using relation key as expected and not producing any results
- Advanced search form with filters for custom taxonomies and custom fields
- How to Add Custom Fields to a Custom Post Type?
- Using meta_query, how can i filter by a custom field and order by another one?
- meta_query for keys that aren’t yet set
- WP_Query orderby custom field then post_date in one query
- What should I use – Taxonomies, custom fields, Post Type?
- clients list using wordpress
- Filtering a WP_Query meta_query by numeric values isn’t working
- Custom Taxonomy Template Post List with Sort Order
- Creating Photo Gallery System with Custom Post Type
- Querying custom post type with 2 custom fields (date-range)
- How Can I save multiple records in same meta key?
- How to do a custom bookmarks post type?
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- order by meta_value serialized array
- How to select one major category (or custom taxonomy) for a custom post type?
- Automatically assign a custom post to a custom taxonomy based on custom field value
- Custom Taxonomy order by Custom Field
- front end radio custom taxonomy with custom post type
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- Is there any performance consideration when using Custom Post Types?
- Custom post type / custom fields
- What is better: Custom Fields vs Custom Taxonomies with Terms for perfomance, scalability and better user experience
- How to add custom fields to admin UI and REST API response?
- Display custom post types with custom date field value (before today) & order by custom date field
- Get Custom Field Values by Another Custom Field in WordPress
- Displaying Metabox value (custom post type taxonomy)
- Query for custom post type objects in a taxonomy and with a meta value
- Custom Posts Hierarchy? (State/City/Restaurant)
- Automatically populate a hierarchical taxonomy from a custom field
- Filtering by Post Meta Custom Fields – Performance
- wp_query to find posts by year and month
- meta_query compare >= not working but
- 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
- How to bulk copy custom fields between custom posts?
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- Retrieve value of a category’s custom field
- Filtering custom post type on a combination of custom taxonomies and custom fields?
- search also in taxonomy, tags and custom fields
- How do I associate a custom post type with another through a taxonomy or storing an ID in a custom field?
- How to filter wp_list_categories output with some custom post type meta query?
- Show custom post type relationships by taxonomy
- Meta Query Not Returning Output Despite Having Matching Values
- Meta Query Filtering not working on Custom Meta Box using Radio Buttons
- Dynamic dropdown select values depending on other custom field value
- Hierarchy and access control for Custom Post Types (CPT)
- First custom field value (out of several) displayed twice after query
- Meta Query posts not showing on ending date of custom field
- Admin Custom Meta Box – Pull Last 5 Posts from Custom Post Type
- How to Output which matched meta_keys were found from custom_type_posts?
- Possible to filter custom post type with multiple meta data?
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- Show fields based on taxonomy selection in editor
- filter search custom field query
- Permalinks: custom structure for taxonomy – tags?
- How to let users choose where to search for posts?
- Query based on custom fields start and end date
- Custom post type’s extra fields – how to handle?
- Creating custom post type with custom taxonomy and custom fields programatically
- WP_query – Filter by tax_query and meta_query using multiple select
- Targeting categories in custom fields
- Custom taxonomies to define versions of a product
- Getting a custom post’s custom field based on another custom post’s custom field select
- Custom Taxonomy Search result page
- How to get_term_meta on single custom post?
- Category Search / Custom Post Type search on my website. Custom Post Types that are “page-like”?
- Many to many to many custom post relationships
- Display a post from custom post type only if all the selected taxonomies and custom field value matches the record
- Custom Query: If One Post Object Field Value Is The Same As Another
- How to fetch custom post types with its full data on wordpress?
- Reusable metabox backend and frontend
- How to populate a Gravity Forms Custom Post Field (dropdown type) with custom taxonomy terms? [closed]
- Get custom term meta problem on single post type
- Custom post type name and assigning custom taxonomy
- Get A Custom Field From A Custom Taxonomy Of A Custom Post Type [closed]
- Building a Portfolio and need some direction
- Custom post types category
- Custom Taxonomy dont save in a frontend form for post a custom post
- How to display posttypes and taxonomy in standard posts, not in a separate label?
- Making a form for user to add new custom post with custom taxonomies and custom fields
- Should i use custom post type for a custom footer?
- Order custom posts by taxonomy, then by meta_key
- Confusion about how to use Custom Post Types, Custom Taxonomy or Category?
- Displaying Posts Using a Custom Query with a Custom Field and a term_id
- Writing a custom Glossary plugin
- How do I ensure that post_type and Taxonomy use the same slug?
- add_filter get array data before display in custom post_type
- order the meta query results by 2 custom fields
- Custom taxonomy terms as children of multiple custom post types
- ACF – Retrieve custom taxonomy from a relationship field
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- Dynamic template page calling shared taxonomies CPT or Plugin post type : how to clone taxonomy for plugin + set up dynamic shortcode
- Using OR relation in meta_query to check for a value before sorting by another
- Category display using conditions
- Query custom fields with three dates – start and end does not work
- edit index custom post type page with elementor or other