Yes, there is — use a meta_query
with 2 clauses, one which selects posts having the meta, and the second clause with a 'compare' => 'NOT EXISTS'
which selects posts without that meta.
So in your $args
array, just replace the 'meta_key' => 'pld_like_count'
with this one:
'meta_query' => array(
// make sure it's OR
'relation' => 'OR',
array( // selects posts having the meta
'key' => 'pld_like_count',
'type' => 'NUMERIC',
),
array( // selects posts without the meta
'key' => 'pld_like_count',
'compare' => 'NOT EXISTS',
),
),
Related Posts:
- WordPress Meta Query: Relation is not working correctly
- Comparisson between date() and a date from wp_postmeta
- Advanced Custom Fields query
- FacetWP group listings by custom field [closed]
- how do i remove posts from a WP_Query so the pagination is right?
- How to query the custom fields by language?
- Redirect to another page using contact form 7? [closed]
- Meta query for comparing two dates
- What database state changes happen after a post is manually “updated” with no changes?
- How to pass multiple custom fields as shortcode’s parameters
- How to delete only user meta value (not key) from usermeta table in wordpress?
- WP_Query orderby custom field then post_date in one query
- Filtering a WP_Query meta_query by numeric values isn’t working
- wordpress get meta value by meta key
- How can i force Display names to be the same as Usernames?
- Trying to perform complex custom field query with order by set to field value
- Add custom meta box on Post page
- Find out if request is for custom post type archive before query runs
- how to display all posts Custom fields dynamically?
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- meta_key and meta_value not working together
- How to create Repeater fields using Advanced Custom Fields?
- Difference between ‘LIKE’ and ‘IN’ in meta queries
- Filtering by Post Meta Custom Fields – Performance
- medoo framework in WP plugin
- WordPress logo upload option in theme panel
- Accessing GET variable named ‘error’
- WordPress CMB2 – Run function on save
- How can i list random post from multiple category?
- Carbon Fields use in custom plugin class
- Returning a list of custom post types excluding those without a specific meta_value
- How I can get custom field’s current value?
- Woocommerce – How to populate custom select field with stored values on checkout page?
- AJAX search posts and pages
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- meta_query BETWEEN, but the range is stored in the custom field
- How to toggle between two custom fields in WordPress woocommerce ‘WC Product Field Group’ plugin?
- WP_Query and NULL meta keys
- Large AND OR query timing out
- WordPress page and plugin list using sql query
- How to create a custom shortcode based on the layout?
- Unable to select image using custom image field type
- ACF: post query, hide duplicate values [closed]
- How to insert multiple postmeta values with one query?
- Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months
- Replacing global wp_query
- Getting a custom post’s custom field based on another custom post’s custom field select
- How to Resize the Custom Post Images?
- Amazon.com intergration with WordPress?
- Display posts with specific value first in query
- How can I store data from custom fields to custom tables?
- Plugin that lets visitors Like a post (not facebook) and stores likes in custom meta?
- Parent Child Custom Fields with Advanced Custom Fields
- grab or load text on demand
- Dictionary-style definition list plugin
- Advanced Custom Fields Plugin – Images not displaying
- How can I modify my meta_query to work with prices that are stored in the database that contain dollar signs and commas?
- meta_query weird behaviour, static int will work, but not user data
- What snippet do I need to type to show my ACF field show up on my theme?
- Is there a way to make [Table Of Content] plugin while not using revision data?
- ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
- adding dynamic/multiple slug values in ‘option_none_value’
- Trouble with serialized metadata
- How to get a specific string from a url
- Adding Custom Endpoint in WordPress Rest API
- General Term for this form Field
- How do I change the functionality of an image slider which is part of ACF?
- Make custom post types using ACF
- Performance considerations – postmeta table versus new table for custom posts with foreign keys?
- Checkbox field that add a subscription product and change prices of other products in checkout and cart page
- Query against multiple locations within single custom post type post
- Is it possible to custom set query for a WordPress REST API response?
- WP_Query, ACF field and array
- Order by Date Custom Field
- If I am not writing a theme, how do I add custom fields to a user for a plugin
- Taxonomy question
- wp_schedule_event function reference
- Add custom field for users
- Creating a user ‘add custom field’ section
- How can i see/log all requests coming from a registration form (not from the UI)?
- Advanced Custom Fields (ACF) Plugin – Random Image in Sidebar
- wp_query for more fields plugin
- What method should I use for a sidebar widget that reads latest posts?
- wpdb get_var is not returning any result (verified mysql query returns only one value)
- force category table refresh when adding new category
- Making a Custom Post Type Publish Loop
- Querying meta values within an array
- Include subtitle display to slideshow
- get_post_meta does not work
- ACF: Hide a div or template section when a custom field (in a field group) is empty
- wordpress last all added get meta value by post id
- How ACF Advanced Custom Field works with Woocommerce Single Product [closed]
- How do I add custom fields to the “Edit page” admin screen?
- Displaying Random Image from ACF Options Page [closed]
- Need help saving input fields for Security Deposit plugin in WC Vendors page
- Adding a variable to a meta field in the backend?
- ACF: Not displaying ACF data from another post
- Order shipped by which driver[hook for woocoomerce order staus changed and popup in admin panel ] [closed]
- How to change data format in custom meta box field [closed]
- Is there a plugin or another way that can help me find out the underlying files of a page/post? [closed]