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?
- WordPress Post Query Using Custom native MySQL like St_Distance_Sphere
- Print Current Post Index number within Loop
- Should we trust the post globals?
- Keep featured content post in homepage with original order
- How to detect single.php (but not single-portfolio.php)?
- How to show related posts by category
- How set featured posts using checkbox in post edit screen?
- the_author() returns empty string
- Get first post from wp_query
- Custom Single Post By Category
- Do we still need to include a “if (have_posts())” in templates?
- WP_Query: Why is sticky post not first item in loop?
- Query *only* sticky posts
- Using single.php from plugin folder instead of default template folder
- rewind_posts() – what actually the use of it, and where using is required or preferred?
- Custom permalink structure only for default posts
- Skip post in loop and mixin later
- Related Posts by Multiple Tags?
- How to show list of posts by author and category?
- Override the default number of posts to show for a single loop?
- How do I create a link that will always show the latest post?
- get comments and get posts in loop
- How do I reorder (pop and push) items from WP_Query?
- How to display posts by current user/author in a custom page template?
- post_name empty after wp_insert_post
- Reverse chronology of post listing
- Query posts distinct authors
- Why do I need to use The Loop on pages (inside page.php etc)?
- How to get previous 10 days post from a specific date – WP Query
- posts page – different lengths of excerpt
- Number of posts per page setting is not working?
- WordPress Number of Posts Not Changing With posts_per_page
- how to display full post with pagination on home page
- Post X of Y in single.php / sidebar.php
- HTML code in Custom field
- Count singular post views automatically
- Looping through posts per category gives same posts for each category
- WordPress Posts Out Of Order after 3.1 Update
- Find most recent authors
- Query only Posts from Both of Two Category?
- This AJAX Code Doesn’t Work – Looking for elegant solution
- Insert custom div between posts
- Display All Sticky Post Before Regular Post
- Cannot access current post’s ID in custom plugin
- Get the author of the latest revision
- Only display posts with comments
- Single.php Active Category Class
- Specific loop in Shortcode
- Strange switch_to_blog() issue
- Show a list of recently viewed posts to a user
- Multiple loops in same page, without duplicate content
- loop not displaying posts on custom template page
- Repost post on specific date every year
- How to use alternate post layout at key points in post loop?
- Alternate custom content in the loop
- Order post by year DESC and month ASC
- Showing random content / pictures from earlier posts in a sticky post?
- Search widget breaks when using multiple loops?
- WordPress get posts by date without query_posts
- How to add shortcode tags in single.php [closed]
- get_terms parent for current product only
- custom single.php not working
- Different amount of posts on homepage than paged pages
- Displaying the number of posts in a custom loop (without including the number of posts of a loop below)?
- Featured Posts for Category Pages
- Display Latest Post from all Categories
- How to display different single post template based on author?