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?
- Apply the_title() filter in post & page title, but not in menu title
- Update post counts (published, draft, unattached) in admin interface
- Including categories in search results
- Removing any and all inline styles from the_content()
- Search Custom Post Type Pages and Custom Fields in 2 Dropdowns?
- using wp_update_post on save_post
- How to put last edited entry on top of the blog-post list?
- Query posts from current year
- Update existing post dates to random dates
- Search not working with title and content
- 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
- Filter/Remove HTML Elements on all posts and pages
- How to output comments number of a post per day?
- How can I display a specific user’s first published post?
- how “manage_posts_custom_column” action hook relate to “manage_${post_type}_columns” filter hook?
- How can I get all posts data from within a paginated search result?
- If specific user role then sticky post
- the_posts filter been called multiple time
- Only display posts after current date
- Differentiate between posts and pages in search results
- Modify WP_Post before processing
- Count search results in heading
- Display post from specific date
- Private Posts/Pages & Search
- Display number of posts via adress bar?
- 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
- Applying $posts_clauses filter to specific queries only
- 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
- If modified on same day, show only time
- Update all comments time to random dates?
- How to hide html tags on revision comparison pages?
- Ajax post filters not working
- Display Meta Values in Custom Filter – Admin Custom Posts
- More then one menu items are assigned with “current-menu-item” class
- Search results posts_orderby and ID
- Worpdress function for difference dates
- add to end of post in the loop with plugin
- Adding bootstrap classes to video shortcodes
- Changing default WP-Site creation date
- How to add add more properties to WP_Post object in search results loop
- Total number of posts in query (category/tag/author/search results/main page…)
- Filtering posts on Post Administration Page by Week Number instead of by Month
- Change the default blog post post attribute template name from “default template” to something else
- See if a post has a specified tag
- Is it possible to add a shortcode below post title?
- What date to use as a post date? date_gmt or modified_date_gmt
- Post filtering is returning blank page
- Updating permalink structure using ‘post_link’ filter results in 404 error for posts
- Modify this line to give alternate format date?
- Date is wrong on ‘all posts’ page
- Hide parts of the post content after typing it’s name or searching it by category
- search content of pages and list in wp-admin
- wp_list_categories() Exclude All Categories Except One
- Get current taxonomy and display query accordingly
- Will multiple category descriptions effect my search engine optimization?
- Trying to exclude custom posts based on date, while sorting by custom field
- Get post publishing date from within custom HTML block
- Show only posts with titles/permalinks that do not contain certain words
- Filter posts by month (dropdown)
- Restricting displayed posts to posts from only select authors
- Search results with pagination not working
- How can get the last post date of the user?
- How to search through “post title” and “tags” using WP_Query?
- Need to display a Jan 1st post as the site’s front page on Jan 1st, and Jan 2nd post as front page on Jan 2nd etc
- Remove pagination if search returns empty
- Set a post expiration and delete a post when expirate
- How to add a block to a category page?
- Add view to admin menu to filter for specific criteria ( If post is child of specific Parent )
- Add id attribute to h1 element of wordpress post
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- Find post tags words in post content and link them to tag URLs
- Custom author search
- Is it possible to completely replace a post with an action/filter?
- Add review box by function at top or bottom of content
- How can I set and update the the_date according to a custom field of the post
- Set post beginning date and final date
- Skip posts, but keep posts per page
- How to display an icon when a new post is published and then remove it when a specific time past?
- Customize search results to include custom posts and display in a specific template page
- How to modify specific parts of a post content in WordPress
- How to organise post by category and date
- Last three posts not being put in order by date. How to fix this?
- How to change text (date) in post base on the day
- Related posts by searching post tags of single post as terms
- wp_query posts sorting doesn’t work
- How to remove a date from wordpress post
- Exclude posts by date – related post