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
- Advanced search form with filters for custom taxonomies and custom fields
- Using meta_query, how can i filter by a custom field and order by another one?
- WP_Query orderby custom field then post_date in one query
- What should I use – Taxonomies, custom fields, Post Type?
- Filtering a WP_Query meta_query by numeric values isn’t working
- 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?
- 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?
- Get Custom Field Values by Another Custom Field in WordPress
- Displaying Metabox value (custom post type taxonomy)
- Custom Posts Hierarchy? (State/City/Restaurant)
- Filtering by Post Meta Custom Fields – Performance
- wp_query to find posts by year and month
- meta_query compare >= not working but
- 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)
- 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?
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- filter search custom field query
- 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?
- 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
- 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
- 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?
- Writing a custom Glossary plugin
- How do I ensure that post_type and Taxonomy use the same slug?
- Custom taxonomy terms as children of multiple custom post types
- 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
- Display Posts that fit a certain criteria on Category pages
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- Display Custom Field or Custom Taxonomy in front page /post/product
- Orderby if between two meta fields
- PHP Warning with Custom Fields
- I want to create a metabox under custom taxonomy
- Sort custom post archives by a meta value from a different custom post type?
- Adding a Section for Visitors
- Custom taxonomy template for custom fields loop [closed]
- Meta_Query refuses to return results
- Sort loop by custom field from different post type
- Meta_query by date for Events archive
- What’s the most efficient way to get two queries based on an if statement?
- Query events post type after current date and timezone
- Need some suggestion/help with custom post types project
- Best way to use Category & Custom Fields?
- Selecting posts older than the current Unix epoch timestamp
- Unable to get the upcoming events for custom post
- custom taxonomies are not showing up in get_taxonomies
- Storing/querying custom date data
- Advanced search form with filters for custom taxonomies and custom fields
- WP_Query arguments: Loop through custom post type – get all entries except excluded meta_key?
- Querying meta values within an array
- Custom Post type as Taxonomy
- How to change order of custom post types. I want Featured post to come first
- Check for custom field value in different post type than current one and do something
- Function to Compare CPT Post Custom Value with Default Posts CF Value
- I want to understand plugin implementation of custom posts / taxonomies / metaboxes
- Custom Sort Order for Custom Post Type Taxonomy