I am assuming you are doing something like this:
if (have_posts()) {
while (have_posts()) {
the_post();
if(x == j){ //inject post here }
}
}
Injecting a post inside the Loop like that will cause the post count for that page to differ from the posts_per_page
value, but it will not break pagination (which seems to be your primary question). Pagination operates on the main query (usually) and that will not be altered by your insertion.
I don’t know how you are retrieving the additional post data but if you are not careful you can break things with that.
Related Posts:
- Blog post per page setting conflicting with custom WP_Query?
- 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 Display Post View Count
- Different amount of posts on homepage than paged pages
- Converting multiple loops into one single loop with pagination
- How would I get 1 latest post from a query for 5 posts?
- How to display different number of posts
- 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?
- Display all posts that were published before full post on single.php
- 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
- Blog page pagination is not working after using the offset argument
- How to : pagination in 3 different custom loops on the same page
- Pagination with an array of post objects?
- Start WP Pagination From Number 1 in URL
- Use two different post_per_page limits with infinite scroll
- 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
- Getting blog pagination to work on page set as front page
- 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
- Pagination for normal (standard) posts on a page with a custom loop?
- Numbered Pagination Showing The Same Posts After Altering WP_Query
- How to show post views shortcode data for each post on Posts List Page?
- How can I get the last post while on the first post for pagination? As if it were infinite
- Can I Paginate Post after every 25 tag?
- Use special template for the first post in the loop
- Posts are not showing up on next page.
- 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
- Not displaying any articles on a custom made file
- WordPress posts loop pagination – first page return 125 posts instead of 10 and the rest return 10
- query_posts different amount of posts per page [duplicate]
- 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?
- Change Posts per page count
- Keep featured content post in homepage with original order
- How to show related posts by category
- The next_posts_link() works only with original $wp_query
- How set featured posts using checkbox in post edit screen?
- the_author() returns empty string
- Get first post from wp_query
- Do we still need to include a “if (have_posts())” in templates?
- WP_Query: Why is sticky post not first item in loop?
- Allow variable amount of comments before pagination
- Query *only* sticky posts
- Skipping first 3 posts in wp query
- rewind_posts() – what actually the use of it, and where using is required or preferred?
- Skip post in loop and mixin later
- How to show list of posts by author and category?
- How to load paginated post pages via ajax
- How to disable content pagination?
- Override the default number of posts to show for a single loop?
- How to Group Posts by the First Letter or Number?
- get comments and get posts in loop
- Get the number of posts from the current page results
- 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
- Custom post order returning posts from other categories
- blog post displaying within older post – loop issue?
- CSS code for “inserting a custom post divider” after each post
- What function does the loop of displaying posts?
- What template file is used by default for posts?
- Count words for all posts by all authors
- Word count for all posts of all authors
- Do I need to create a multisite for querying posts from multiple WordPress sites?
- View post with specific category id and name which I selected in the backend (drop-down option)
- Show a page counter for pagination
- Dynamic archive of posts by date
- Show number of posts AND number on current page (cannot make it work)
- Sort Posts Alphabetically Based on Specific Category (Divi)
- WordPress Ajax load doesn’t work
- How to change url of posts?
- Global $post value outside the loop
- How to get total posts count for each date?
- WordPress current post functions inside loop doesn’t work anymore, are they incompatible with php 8.0?
- List of published post dates only outputting one date
- Is it possible to use the_post 2 times in one loop
- How to show related posts by detecting the current category?
- Display posts on a custom page from only a specific category?
- Category Attachment Pagination 404 Error on 2nd Page
- Parameter for pagination posts_pagination
- Shortcode in loop always display data of first post on the page