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?
- What is the easiest way to create a custom field archive?
- How to filter posts with a wp query by a custom dropdown type field with the magic fields plugin
- WooCommerce shop page orderby [closed]
- WP_Query: include custom post type only with specific meta value
- 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?
- UnWanted Custom field added in the wp page edit area
- How to make Meta Query case sensitive?
- Woocommerce – How to populate custom select field with stored values on checkout page?
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- Get posts from WP_Query and format them on admin_head
- Not getting author rank when using return
- wp_query check if integer exists in custom field’s array
- Implement Autocomplete for a custom field on WordPress Plugin Frontend
- How do I “get the next 10 posts after post_id == x”?
- switched from query_posts to WP_query, not working now?
- AJAX search posts and pages
- DROP TABLE with uninstall hook not working
- Assign / update custom field value for all posts (How can I assign only to posts without custom field value?)
- Fetch Record based on meta key dates
- Meta_query with multiple keys and multiple values
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- How to change this WP_Query to get all ProductIDs and not only specific one?
- meta_query BETWEEN, but the range is stored in the custom field
- auto populate list of questions if user select a category xyz
- is there a way to link one of the field in ACF field group, to a field in a media attachment page? [closed]
- How to toggle between two custom fields in WordPress woocommerce ‘WC Product Field Group’ plugin?
- Extend product search with meta in WooCommerce
- How to create an input field, and base the output on spreadsheet data? [closed]
- how to make members list directory through wordpress post custom meta key.
- How to call WordPress function other files
- Insert content of a post into another
- How do I hide posts across all loops based on the value of a custom field?
- WP_Query and NULL meta keys
- Large AND OR query timing out
- how to use in custom single.php template using php?
- Custom User meta field display
- meta_value_num not ordering all items
- WordPress page and plugin list using sql query
- How to create a custom shortcode based on the layout?
- Using AJAX to generate front end / viewer end pages
- Possible to filter custom post type with multiple meta data?
- Meta Query And/Or
- Execute js files doesn’t seem to work
- WordPress metaboxes – textfield suggestion automatically populated
- Char limit on custom blog-post form? [closed]
- Unable to select image using custom image field type
- Query based on custom fields start and end date
- meta_compare not comparing whole integer
- WooCommerce search products between price range using WP_Query
- ACF: post query, hide duplicate values [closed]
- Every new post/draft has a custom field variable “yst_is_cornerstone” showing
- Is it possible to retrieve all posts with a certain value for metadata?
- Custom Post Type Fields
- How to insert multiple postmeta values with one query?
- How do I enforce users to fill a determined custom field using WyPiekacz?
- How to Loop Through all Posts and Count Attachments using Get Media Attachments
- How to get a list of bundled products using wp_query in woocommerce
- order posts by `meta_key`, Does not display posts that does not have `meta_key`
- WordPress Apply filter in plugin causes 500 internal error
- Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months
- Adding class to last list item? Not WP generated
- 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?
- Sticky option for custom post types without using custom fields or plugins
- Error in pdf generating plugin using FPDF
- Return multiple values in a shortcode attribute
- WP_Query: getting posts where custom field exists
- How do we update a custom file upload field with the Advanced Custom Field plugin?
- Order posts by meta key ( Using ACF )
- How to add fields in the WordPress editor?
- woocommerce search by sku and title ajax
- Display posts with specific value first in query
- Get every post with value in meta key
- Loop returns the current page’s permalink and guid instead of the post in the loop
- Search users with custom meta data
- WordPress function to add text warning on every pages [closed]
- Add user meta after a user has registered and logged In [closed]
- How to get CPT category checkbox list and show post of selected(multiply) checkboxes via ajax?
- BuddyPress activity on edit post for a CPT
- add_query_arg to compare and display events from a certain date
- How to add an extra, independent set of custom fields?
- Price comparison table based on Custom Post Type?
- Comparing 2 Decimal Numbers from custom fields and displaying posts
- Show related posts based of current ACF field name in a single page post (a loop within loop)
- How can I store data from custom fields to custom tables?