If I’ve understood the case correctly your $args should be something like that:
$args = array(
'posts_per_page' => 5, // what ever you like
'paged' => $page, // page number tracker
'post_type' => 'post', // or change to custom
'post_status' => array( 'draft', 'publish' ),
'meta_query' => array(
array(
'meta-key' => 'pb_match_date',
'meta-compare' => 'EXISTS'
),
),
);
This will return all posts where ‘pb_match_date’ exists, then you can extract the value and build upon.
You can always reference the codex for more details:
Related Posts:
- Saving custom fields for WP_Query to retrieve
- meta_query with meta values as serialize arrays
- Use REGEXP in WP_Query meta_query key
- WP_Query with checkbox meta_query
- Getting attachments by meta value
- How to grab metabox value in wp_query meta_query key
- What is an efficient way to query based on post_meta?
- WP_Query not working as expected for attachments and custom meta_query
- How can I create a WP_Query that returns posts where one meta_value
- WordPress altering my custom query, How to fix it?
- WP Meta Query for some meta (array) values
- How to get sum of meta_values of a meta_key in wp_query according to conditions
- Order posts by meta value and Date
- Get meta info related to current post
- How to make Meta Query case sensitive?
- Performance when getting post meta for post retrieved by meta value
- Get attachment by meta_key value
- Fetch Record based on meta key dates
- how to make members list directory through wordpress post custom meta key.
- Large AND OR query timing out
- New WP_Query loop in admin causes problems
- Filter posts by comparing custom meta value against postdate
- Nested array issue in meta_query
- How do I add an item to the WP admin menu?
- WP_Meta_Query object with conditionals
- Query posts by searching for a string in a meta field
- WP_Query meta compare must include ALL array values
- How do i create a custom post query when the meta value is an array?
- wp query to use both author id and meta_query
- meta_query with meta values as serialize arrays
- Meta query ignores multiple values of the key
- Trouble with serialized metadata
- show most viewed post
- Why can my filter query SOME metadata but not other metadata?
- Query against multiple locations within single custom post type post
- How to set meta_query if get_post_meta returns nested array for that key? [duplicate]
- update_post_meta() not updating
- Query by meta value (add a dropdown of all values)
- WP Meta Query at depth 2
- WP_Query Posts by Metadata from Option Tree
- Return a single custom post from multiple meta queries
- WP_Query by meta key not returning any posts
- order by numeric value for meta value
- How to query posts based on lat-lng coordinate as post meta?
- Set Alias for meta_query arguments in get_posts()
- WP_Query displaying ALL posts
- WP_Query meta_query where meta value ends in space
- Nested query inside Logical operator OR not working in meta_query
- How do I create my own nested meta_query using posts_where / posts_join?
- How to order a post type with meta_value_num and if meta_value_num does not exist then order by date
- Can’t sort order of wp_query with 2 meta keys
- Exclude post on loop by multiple meta key value
- Best approach to create Hot and Trending sections
- Query sticky posts with thumbnails
- How to make orderby ‘meta_value_num’ OPTIONAL?
- Meta query with order by another custom field
- Order a query result by a numeric meta key even if it does not exist, but put the posts with meta key first
- Single meta_query query using OR instead of AND in request’s WHERE statement
- WP_query posts closest to todays date
- SQL: What is wrong with the following query (generated by WordPress WP_Query, ordering prices)
- Why isn’t my `meta_query` array functioning properly?
- Using hook to use DISTINCT in a wp_query
- Overwrite YoastSEO meta-tags with another page’s [closed]
- How to orderby multiple meta fields if some fields are empty
- Suggestions on making this query/code more performant
- Where to put meta Keys
- Order by meta value (numeric value lower to higher)
- WP_Query with different postmeta filter for each categories
- Slow WP_Query with ‘OR’ on meta_query
- How to filter a query by multiple meta keys and order by other meta keys
- Meta Query doesn’t works as espected
- Displaying a div from an assigned meta_value when on a page
- Display posts with specific value first in query
- WP_Query: apply an SQL function to meta fileld value
- Filtering by multiple conditions in the loop
- Display count number of posts with the same specific meta_key meta_value
- WP_Query with 4 post meta field arguments gives 500 internal server error
- Use have_posts() with array of post results retrieved by $wpdb->get_results
- Custom meta_query order for Elementor based on post meta key [closed]
- What’s wrong with this meta query? (order by meta key, then title, doesn’t work)
- ElasticPress is (aparently) messing with my search filters
- How to improve my non-unique metadata MySQL entries?
- Check for not NULL not working in meta query
- Get unique post by meta value using wp_query
- WP_Query, ACF field and array
- WP Query. Ordering posts by another post types meta
- Complex Meta Query
- Get posts meta_query by repater field
- Query 3 meta_key and orderby
- wp_query sorting – one specific meta_key value at last and then sort by create date
- Filter posts/pages by user_role array
- WP_Query with MetaQuery issue
- WP_Query with meta_value_num and meta_query not paged correctly
- Post Query not working after updating to 4.1
- The sorting of posts by a meta_query with two keys fails while separated as single queries it works
- Sort Posts with custom meta key by default which is currently set as optional
- WP_Query with several meta_query-statements and order by meta_value
- Using ‘meta_query’ with the ‘pre_get_posts()’ hook disables searching for post titles
- Get posts using multiple values from ACF checkbox as meta query wordpress
- WP Query returning all posts when Meta_query is null