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
- Why does ‘get_the_ID’ work outside of the 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?
- how to display full post with pagination on home page
- 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?
- Display post category in foreach loop with category link
- 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 add tags (custom taxonomy) to post class css?
- Listing Specific Categories from Current Post with Depth
- get_the_category listing in hierarchial order
- Exclude current custom post on single post
- Nested WP_Query breaking loop
- Custom taxonomy archive page problem
- Loop don’t work within single.php page
- Query for first 3 posts to change the look and feel
- Getting blog pagination to work on page set as front page
- Make loop inside slider divisible [closed]
- How to display post list in a table layout (multiple queries in single loop)
- Not all posts showing in query
- WordPress query portfolio posts
- How to get posts ordered by using their categories?
- How to separate each individual blog post?
- How to assign a post to a post parrent?
- get parent fields title, content excerpt etc
- Is there a way to define the $post var outside the loop?
- AWS usage queries
- Only the most recent post is showing on my category page (working on localhost, not live site)
- How to fetch courses in all languages in WordPress?
- WP posts using index.php instead of single.php
- Single post shows post three times
- How can I use query_posts to loop through posts and construct my own content?
- Show 5 posts and than 3 posts offset with pagination
- Can I Paginate Post after every 25 tag?
- Alternative content between posts no repetition
- Start loop from specific post ID
- Display new posts categories in separated divs
- Get the category of post
- WordPress loop uses unmodified posts array, why?
- Add row after three columns
- Custom Single Post Type not referring to single-post-type.php File
- Skip posts, but keep posts per page
- index.php is only displaying current month’s posts?
- Loop doesn’t display posts. It displays a link to the home page instead
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- Grab next post title in archive page
- Remove duplicated posts in the loop if post has more than one category
- Getting posts from multiple users?
- Show post if in category
- Displaying categories items among posts
- Get current post’s child page?
- single.php fires more than once after clicking on any post to view with different post id each time
- Show all posts in category
- First post in loop displays twice
- Is it possible to use the_post 2 times in one loop
- Display related posts that match as many similar tags as possible?