Rather than re-post the posts, we can create a custom query for the current day’s post regardless of year. We use current_time
to get the current day and month according to the site’s timezone settings, then we create a new query containing date parameters for month and day. We don’t specify a year, so it’ll return anything posted on this day from any year.
$day = current_time( 'j' );
$month = current_time( 'n' );
$args = array(
'date_query' => array(
array(
'month' => $month,
'day' => $day,
),
),
);
$today = new WP_Query( $args );
if ( $today->have_posts() ) {
while ( $today->have_posts() ) {
$today->the_post();
// output the post
the_title();
}
wp_reset_postdata();
}
Related Posts:
- Print Current Post Index number within Loop
- How set featured posts using checkbox in post edit screen?
- WP_Query: Why is sticky post not first item in loop?
- Display all posts from specific categories on a page
- rewind_posts() – what actually the use of it, and where using is required or preferred?
- Skip post in loop and mixin later
- How do I reorder (pop and push) items from WP_Query?
- How to exclude latest x posts from a paginated query?
- Display content from a specific category
- Reverse chronology of post listing
- posts page – different lengths of excerpt
- how to display full post with pagination on home page
- Find most recent authors
- This AJAX Code Doesn’t Work – Looking for elegant solution
- How to Display Post View Count
- Displaying the number of posts in a custom loop (without including the number of posts of a loop below)?
- The correct way to call posts with ajax
- Converting multiple loops into one single loop with pagination
- Group posts by year in loop
- How would I get 1 latest post from a query for 5 posts?
- Alternating post layout
- Check to see if specific loop has less than certain amount of posts
- get_next_post() and get_previous_post() return wrong posts
- Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
- Display post from current category and same tag?
- Inserting custom data to the_post() during loop
- Multiple loops are not reset
- Exclude category from
- Blog post per page setting conflicting with custom WP_Query?
- Pausing and Resuming WP_Query results
- Post Loop Missing Most Recent Post
- How to : pagination in 3 different custom loops on the same page
- Sharing post from archive page (loop) doesn’t work
- Get Image tag from content of post
- Start WP Pagination From Number 1 in URL
- Use two different post_per_page limits with infinite scroll
- How to make the first post in the loop be styled like a “new / featured” post?
- How to setup a query to output posts by groups of five?
- How to order posts in an arbitrary order?
- Wrong post title displayed from loop
- Change all author links in Blog roll
- Showing categories and subcategories with posts
- Get the amount of posts on a current page
- How to add a class to each individual post?
- How to get posts published on the latest date?
- How can I remove the first two words and shorten get_the_title()
- Page and post loop same template
- WordPress Query Posts From Category Post on Static Page
- ACF to select posts not displaying on blog page
- Loop through posts? Want to remove extra newlines in actual post HTML/content on backend
- How include css class based on post ( in loop ) slug?
- WordPress Loop: How to display recent posts in multiple divs
- Querying another post category to match current post and display in loop
- How to display posts on custom page without declaring a posts page in reading settings?
- Cannot implement byline into posts container in single.php
- how to handle the loop using filling bootstrap grid structure?
- How to check if there are posts with the same tag
- WordPress loop not working on static front page
- Custom WP_Query not working correctly
- Display specific posts on home page
- The loop starting at a certain ID
- WP_Query of Category Not Showing First Post
- Loop not showing first post
- posts going to 2 pages/categories only show up in 1
- Custom Post Type Single Loop Outputting Wrong Post
- Using the loop to set locations for all posts on a single google map
- Get current taxonomy and display query accordingly
- Shortcode for Comments and Comment Boxes in Post Loop
- Multiple post in One Loop in wordpress
- Display specific posts based on an ID of another post
- Diffrent layout for posts [duplicate]
- How to distinguish pages created by woocommerce?
- Moved a website and excerpts don’t work for old posts
- Double loop output
- how to call recent post content in a loop ( only the content before read more tag)
- post->ID displays the same ID number for every post
- Show post excerpt
- Show author bio box
- Use special template for the first post in the loop
- Can the_post_navigation() be outside of the loop?
- WordPress infinite post cycle problem
- How to get all posts in gallery post format template
- Show Posts By Custom Field
- List of authors posts minus very latest
- Querying multiple categories in the WP loop if one of the category IDs is dynamically obtained
- Post are not showing up
- show latest authors blog post
- Post gallery as carousel
- Showing content from WordPress ruins page CSS using WP_Query, without, content does not show
- Add something after all sticky posts in The Loop
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Display Post by menu order
- Getting rid of the blog page entirely
- Is there a way to separate wordpress titles from their posts?
- adding custom meta as well as looping through posts
- Redirecting posts in WordPress to a specific page
- ‘posts_per_page’ => ’10’ does not show any post
- When and how will php code in a user made WordPress page be executed?
- Query wordpress posts on static page
- posts_per_page – Repeats only first posts ‘post__in’ array