If your posts store the date in a consistent format like YYYY-MM-DD HH:MM:SS
, etc, you could compare with strings using regular expressions, like:
$current_date = new DateTime();
$datemonth = $current_date->format("m-d"); // MM-DD
$args = array(
// …
'meta_query' => array(
array(
'key' => 'birthday',
'compare' => 'REGEXP',
// Regular expression explanation:
// ^ - Start of string
// \d - Any digit (0-9)
// {4} - Four of the previous token
// \d{4} - Four digits
'value' => "^\d{4}-$datemonth",
Related Posts:
- How to sort CPT by custom meta value (date), and return posts month by month
- Meta Query posts not showing on ending date of custom field
- Sort custom post type by most current date picker
- How to display a WordPress Custom Field only on a specific day of the week?
- Problem with date comparison for custom fields
- How to sort WP_Query by a custom text field (written as a date dd/mm/yyyy)
- Pre_get_posts comparison with custom field doesn’t work
- Get month and day from a Date Picker custom field
- How to get past and upcoming post by defining date in custom field?
- How to display custom post type ordered by a custom field date
- Is it possible to specify a time interval (from, to) in ACF with date picker, or other custom field?
- How to display *block number* instead *date value* on WordPress posts?
- How to Add Custom Fields to a Custom Post Type?
- Do_Shortcode not working for Embed
- Display custom post type and custom fields within a Bootstrap Carousel
- how to filter by last name for custom post
- Search that will look in custom field, post title and post content
- clients list using wordpress
- Custom Taxonomy Template Post List with Sort Order
- Display Custom Post Type Fields
- How to do a custom bookmarks post type?
- How do I add media to a custom post type?
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- WordPress query by multiple Custom fields and order by date
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- add_meta_box: Datepicker like the one for postdate?
- Custom Post Types – How to include custom fields
- Custom field losing p tags on display
- Using posts and postmeta table to store custom Address Book Plugin data
- Query current and future events, ordered by begin date
- Bulk edit custom excerpt text in WordPress
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Frontend posting – everything saves other than checkboxes?
- Search Custom Post Type Custom Fields
- Saving repeated option values in a custom query
- Query Custom Post Types by date (custom field) range
- handling csv data with a custom post type
- Custom fields in Permalinks?
- query posts and custom post type with meta key
- Dynamically add / duplicate custom meta in custom post types
- Problem fields custom date, time, and checkbox
- Custom Post type and Custom Field WP_Query
- Adding Show Less/More link to Custom Post Meta
- Sorting custom post type columns with external data and without meta values
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- Found 2 elements with non-unique id (#_ajax_nonce) and (#_wpnonce)
- Store CPT ‘Reviews’ average ratings to a WordPress DB table or to a DB custom table?
- Repeatable Fields Metabox with Textarea (or wp_editor)
- How to use TinyMCE Editor for one of my custom post meta field?
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- Displaying custom field according to date
- filter search custom field query
- How to add multiple markers on the google map, at a certain meta_key and meta_value
- Custom fields for custom post type
- Sorting posts by custom field value in array
- Custome fields not displayed
- Display a post from custom post type only if all the selected taxonomies and custom field value matches the record
- How do I get_the_postID() for a custom post that uses ACF repeater field?
- How to populate a Gravity Forms Custom Post Field (dropdown type) with custom taxonomy terms? [closed]
- Custom post type name and assigning custom taxonomy
- Custom post types, disable fields
- Best way to create a search for custom post type by custom field values
- Building a Portfolio and need some direction
- Need to have an archive widget which organizes and displays a custom post type using a custom date field
- Display Posts Query with IF function
- Excerpt length: get first paragraph
- Custom PT, Taxonomys and wordpress query
- How can i loop through custom post type according to custom meta field?
- Using global $post; with custom post types
- CMS – User confusion when creating new page and having to select template and save first to see correct fields
- Orderby meta_key/meta_value not displaying anything, am I overlooking anything?
- Creating a custom page post type just like the original “pages” post type using CPT UI
- Using OR relation in meta_query to check for a value before sorting by another
- Sort custom post archives by a meta value from a different custom post type?
- Displaying posts inside table having issues
- Ordering Post by Meta Key (Not Working)
- Error when moving custom post type to bin
- Enforce all custom posts have specific custom fields
- Use WP Title instead of custom field to call
- Custom taxonomy template for custom fields loop [closed]
- Add more custom fields when creating a new custom post type
- How do I display specific custom posts, and how do I edit a post’s singular page?
- WP_posts (Not meta) extra custom field column show and change it in a custom post type
- What’s the most efficient way to get two queries based on an if statement?
- Amend posts using wp_insert_post
- Custom Fields as Post Type Options
- Selecting posts older than the current Unix epoch timestamp
- display some fields in custom post backend
- Forms with multiple element types using custom post types
- Customizing the display of custom post types
- Display custom posts in checkbox list
- Display posts order by custom post in a dropdown menu
- Query recent posts by author
- Extending a CPT by Created by another plugin
- Adding a custom “Add Custom Field” button to Custom Meta boxes
- Create a list of months based posts
- Good practical way to do loop within loop to show child custom type using a template code
- Custom Field in Page Title
- Category display using conditions
- Query custom fields with three dates – start and end does not work