You can use posts_where hook to achieve this
add_filter( 'posts_where' , 'posts_where' );
function posts_where( $where ) {
global $wpdb;
$start = $query->get('ID_VARIABLE_HERE');
// add any condition if you have
if ( ! is_admin() && $query->is_main_query()){
$where .= " AND {$wpdb->posts}.ID >= $start";
}
return $where;
}
Related Posts:
- Showing random content / pictures from earlier posts in a sticky post?
- Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
- Change all author links in Blog roll
- How to I retrieve the ID from the Posts page?
- Accessing Post ID Within Loop
- linking to post outside the loop
- Get post category as a separate string and url
- Where should get_post_meta() go to get $post->ID get_post_meta() is empty and $post->ID & get_the_id() are working
- View post with specific category id and name which I selected in the backend (drop-down option)
- Why does ‘get_the_ID’ work outside of the loop?
- wp_query with ajax
- Update post meta within save_post action
- Loop through posts? Want to remove extra newlines in actual post HTML/content on backend
- Display post number by category
- Updating post meta for checkbox
- Saving Post Data in Another Database
- WP_Query: Show 10 posts in date order, first three random
- 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?
- Custom permalink for each post
- How can I tell if a post has been published at least once?
- Show posts by quarter
- Is there a way getting post fields using `transition_post_status`
- separate the post of a category by subcategory
- Automatic blog page with custom design [closed]
- How to display post list in a table layout (multiple queries in single loop)
- Add multiple meta keys to a post at once
- Show number of posts by logged in user
- How does WP decide how to display a page
- Cannot implement byline into posts container in single.php
- Not all posts showing in query
- how to handle the loop using filling bootstrap grid structure?
- Optimizing the blog loop
- How to check if there are posts with the same tag
- WP_Query custom field pass the post id
- WordPress loop not working on static front page
- When sending a newsletter -not with wordpress- the server has 100% cpu [closed]
- How do post IDs work in WordPress?
- Some doubts about how the loop work (trying debugging it)
- Are post, page and category IDs unique to each other?
- Retrieve data from post meta meta_key having ‘_product_fq_image’ while having author_id and post type is PRODUCT
- Custom WP_Query not working correctly
- Different number of posts per row in grid layout
- Insert data from custom created PHP page into wp_postmeta table
- Optimize CPT-function with a loop
- Display specific posts on home page
- Adding a meta box to determine the sidebar [closed]
- WP_Query of Category Not Showing First Post
- If custom field is empty, use one from a previous post
- Cant’ Grab WordPress Built-in Posts Through Loop
- saving/reading custom field value does not work – no value gets POSTed
- Simple Custom Metabox Not Saving
- How come this loop is not working? [closed]
- Loop not showing first post
- Widget to show posts in the sidebar basing on its IDs
- Limiting the amount of posts retrieved by the loop
- Display 3 posts with different HTML markup using a loop
- Get a post’s ID
- Making posts permalinks consistent numbers
- Pagination for normal (standard) posts on a page with a custom loop?
- Changing wp_link_pages() to “Next Page” and “Previous Page” buttons?
- I can’t find the relevant part of the loop in my theme file. How do I find the full content with “More…”
- posts going to 2 pages/categories only show up in 1
- How to repeat a loop after 4 posts [duplicate]
- Custom Post Type Single Loop Outputting Wrong Post
- Using the loop to set locations for all posts on a single google map
- How to separate each individual blog post?
- How to get post id of last approved comment?
- Defining ‘last’ class on foreach blog posts
- How to get the post id (of the parent custom custom type) in a loop inside a widget?
- Get current taxonomy and display query accordingly
- How to show full post on home page
- Error while excluding a post from another loop (using its ID)
- Is there a way to define the $post var outside the loop?
- ACF flexible content block not showing on live site (works locally)
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Want to change the post every three days with in specific category
- Featured Images most often doesnt appear
- Separate top level categories on archive-product.php by meta
- While loop in functions.php outputting the_title() of each post on frontpage
- Post meta not working
- Shortcode for Comments and Comment Boxes in Post Loop
- How to bulk Update URLs to new values?
- Select another post in a post meta like a parent page is selected while editing a page
- SQL DELETE multiple post_meta on single and multi-sites
- Permalink Short code showing unnecessary link text inside the loop
- Get post slug and match with menu item slug to change css
- WordPress Post ids big increment
- Reuse old post ID for new post after deleting post
- Current post categories and subcatecories outside of the loop
- Private post caught in endless redirect loop
- How to retrieve all meta data directly from the $post object? Such as $post->related_topics?
- Multiple post in One Loop in wordpress
- What is proper filter or hook action to add data to the $post object?
- Display specific posts based on an ID of another post
- Numbered Pagination Showing The Same Posts After Altering WP_Query
- “read more” redirects to the wrong page
- Diffrent layout for posts [duplicate]