How about something along these lines?
function my_filter_where( $where="" ) {
global $post;
$where .= ' AND post_date <= "'.$post->post_date.'"';
return $where;
}
add_filter( 'posts_where', 'my_filter_where' );
$query = new WP_Query( $query_string );
remove_filter( 'posts_where', 'my_filter_where' );
Related Posts:
- How to get posts published between a date and today?
- Display all posts from specific categories on a page
- How to exclude latest x posts from a paginated query?
- Display content from a specific category
- Can’t show comments count per post outside loop
- How to have different content in the loop and single
- How to Display Post View Count
- How would I get 1 latest post from a query for 5 posts?
- Show all posts in sidebar in single.php
- Inserting custom data to the_post() during loop
- How To Get Posts With A Specific Word
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Blog post per page setting conflicting with custom WP_Query?
- How to exclude latest x posts from a paginated query?
- Two loops, one AJAX loop, exclude posts in first loop from second loop, loops are in different files
- How to order posts in an arbitrary order?
- Display Posts on Custom Page
- Wrong post title displayed from loop
- Get the amount of posts on a current page
- How to get posts published on the latest date?
- How to only publish posts with image in it
- WP_Query: Show 10 posts in date order, first three random
- Display specific posts on home page
- Display 3 posts with different HTML markup using a loop
- Changing wp_link_pages() to “Next Page” and “Previous Page” buttons?
- How to show post views shortcode data for each post on Posts List Page?
- Use special template for the first post in the loop
- Modify WordPress loop after it has been run
- show latest authors blog post
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Adding a category at even positions on main loop with modified pagination
- How to inject a post within a loop
- Keep featured content post in homepage with original order
- How set featured posts using checkbox in post edit screen?
- Custom Single Post By Category
- WP_Query: Why is sticky post not first item in loop?
- posts page – different lengths of excerpt
- how to display full post with pagination on home page
- WordPress Posts Out Of Order after 3.1 Update
- This AJAX Code Doesn’t Work – Looking for elegant solution
- How to use alternate post layout at key points in post loop?
- Order post by year DESC and month ASC
- Showing random content / pictures from earlier posts in a sticky post?
- custom single.php not working
- Function to show random posts from a category
- Double count view in archive.php
- Different style for most recent article
- Differentiate between posts and pages in search results
- Loop through all product posts?
- Restrict post navigation to current sub menu
- Display post category in foreach loop with category link
- Using wp_list_categories like the the_category (showing just current categories of a post)
- Displaying Latest Posts on a Page
- Random ajax load only works with posts_per_page set to -1
- Get Image tag from content of post
- 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?
- Order posts alphabetically: how to set order=asc in mysql query?
- Insert sometext after first h3 in content
- While loop articles – if statement order
- Is it possible to customize the post according to post format in single.php?
- WordPress website loads more posts than expected
- How to add a class to each individual post?
- query post limits
- Post type no single page
- How can I remove the first two words and shorten get_the_title()
- ACF to select posts not displaying on blog page
- How to check in functions.php if there is data in a WP_Query?
- Post Filtering by GET URL parameters
- Querying another post category to match current post and display in loop
- All categories displays the same posts
- how to handle the loop using filling bootstrap grid structure?
- WordPress loop not working on static front page
- Query function not executed between element [closed]
- Custom WP_Query not working correctly
- Echo the number of posts being displayed
- Exclude a category of posts in author template
- The loop starting at a certain ID
- Loop not showing first post
- Custom Post Type Single Loop Outputting Wrong Post
- Get current taxonomy and display query accordingly
- Move position in post list for a custom checkbox column
- Multiple post in One Loop in wordpress
- Display specific posts based on an ID of another post
- Diffrent layout for posts [duplicate]
- display multiple posts and posts content on a single URL
- wp_query args with relation
- Show post excerpt
- Show author bio box
- WordPress infinite post cycle problem
- List of authors posts minus very latest
- How to get only current images of a post
- Automatically create a loop for post ID
- Display Post by menu order
- wp_query select if have comments
- Getting rid of the blog page entirely
- Is there a way to separate wordpress titles from their posts?
- Redirecting posts in WordPress to a specific page
- Wrap div-tag around posts in page
- When and how will php code in a user made WordPress page be executed?