I think it’s better to use date_query as argument, like so :
$query = new WP_Query( 'year=2012&monthnum=12&day=12' );
or:
$args = array(
'date_query' => array(
array(
'year' => 2012,
'month' => 12,
'day' => 12,
),
),
);
$query = new WP_Query( $args );
Source : https://codex.wordpress.org/Class_Reference/WP_Query
Related Posts:
- pre_get_posts query between 2 dates (date stored in custom post meta)
- How to filter my search in post if contains a word in title, content or excerpt?
- Posts and Attachments with “Published” status in Search
- show only one category and filter by tag
- How to hide meta from search result only on pages?
- How to get posts published between a date and today?
- Apply the_title() filter in post & page title, but not in menu title
- How to get post creation date?
- Update post counts (published, draft, unattached) in admin interface
- Changing the post date and time with function
- Including categories in search results
- Removing any and all inline styles from the_content()
- Removing filter dropdown in posts table (in this case Yoast SEO)
- Get old values for post before saving new ones
- Is it possible to Schedule Attachments in WordPress?
- Search Custom Post Type Pages and Custom Fields in 2 Dropdowns?
- How does filter the_posts work?
- using wp_update_post on save_post
- How to publish a post with empty title and empty content?
- How to add a “publish” link to the quick actions
- How to put last edited entry on top of the blog-post list?
- Display all search results
- Query posts from current year
- Why is wordpress removing some unicode characters (e.g. some emojis) when I save my post?
- Search posts by post author name
- Update existing post dates to random dates
- Search not working with title and content
- featuring old articles without messing up with the archive
- how to display post content without post image?
- Exclude category on blog list page
- How to remove_filter that filters iframes in posts? [duplicate]
- Filter posts by author and category simultaneously
- how to hide specific post from google search
- Filter post before *editing*
- Filter/Remove HTML Elements on all posts and pages
- How to display an icon when a new post is published and then remove it when a specific time past?
- How to output comments number of a post per day?
- Human Time Diff, change mins to minutes
- How to search only by post title and category?
- Display custom post types by date field
- Search widget breaks when using multiple loops?
- How can I display a specific user’s first published post?
- Pagination not working on custom query
- how “manage_posts_custom_column” action hook relate to “manage_${post_type}_columns” filter hook?
- Can wordpress differentiate between added and updated posts?
- Fetch posts from current week (Sunday to Saturday)
- How can I get all posts data from within a paginated search result?
- If specific user role then sticky post
- Search query – exact post title match
- pagination hook doesn’t work with search results
- How to set post expiration date and time and move the page to archive after expiration [closed]
- Getting post id from wp_insert_post_data function?
- the_posts filter been called multiple time
- Filter Posts By Tag
- Custom excerpt length filter doesn’t work
- Search for posts based on their url in the admin?
- How can i do something after head like adding a hook for after head but before post
- Only display posts after current date
- wp_query ‘s’ parameter does not work with custom post type
- Amend wordpress password function
- Custom Post Templates
- Differentiate between posts and pages in search results
- How can I remove posts of a certain category from homepage after a specified time period?
- How to generate numbers indistinguishable for the IDs of the posts
- Modify WP_Post before processing
- Count search results in heading
- Display post from specific date
- Get random posts between specific dates / of specific age
- Private Posts/Pages & Search
- How to filter posts that belong to a specific category only if that is the only category
- Display number of posts via adress bar?
- XML-RPC and post_date
- Automatically republish old posts
- How to retrieve the postID in a “image_send_to_editor” hook function?
- Tags to Post-ID mysql query. Tag Search
- Filter Custom Post Type by Category with Ajax
- Ajax posts filter by date, comments, top views, top likes
- How to add Tags Filter in wordpress admin dashboard
- Replace ‘published on date’ with ‘modified on date’ on Posts
- Applying $posts_clauses filter to specific queries only
- How to change wordpress dates to native language (even if the languge not available i wordpress)
- how to remove dash (-) post status from post title on posts listing page wordpress
- Admin Posts Table Column Fitlering is not working for Custom Post Type
- Get latest posts from WordPress site without header, menu and sidebar
- Modify Image Source With The_Content Filter?
- How can I show many posts an author has per week?
- If modified on same day, show only time
- What is the filter or hook to add admin controls to posts on the front end?
- Change post order random through out the entire WordPress
- use wpml_post_language_details function other plugin based on $post->ID [closed]
- Update all comments time to random dates?
- How to hide html tags on revision comparison pages?
- Add filter by custom field to block of posts
- Ajax post filters not working
- Default to ‘all’ view on the ‘edit-post’ screen for authors
- Display Meta Values in Custom Filter – Admin Custom Posts
- More then one menu items are assigned with “current-menu-item” class
- Update post_content everytime a custom post is opened in backend
- Search results posts_orderby and ID
- WordPress Sidebar menu for posts based on date – guidance needed