Title: inserting a post that inserts another post causes infinite loop
Last modified: March 14, 2023

---

# inserting a post that inserts another post causes infinite loop

 *  [calioptrix](https://wordpress.org/support/users/calioptrix/)
 * (@calioptrix)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/inserting-a-post-that-inserts-another-post-causes-infinite-loop/)
 * We have a page that includes a post. This post includes two other posts in it.
   When viewing the page it never finishes loading. It will continue infinitely 
   repeating the page content. Viewing the post works fine. Removing both of the
   sub posts resolves the problem. Having either of the sub posts causes the issue.
 * post template file that we are using:
 *     ```wp-block-code
       <?php
       /**
        * Template for displaying a post in the [ic_add_posts] shortcode.
        *
        * @package   Posts_in_Page
        * @author    Eric Amundson <eric@ivycat.com>
        * @copyright Copyright (c) 2019, IvyCat, Inc.
        * @link      https://ivycat.com
        * @since     1.0.0
        * @license   GPL-2.0-or-later
        */
   
       ?>
   
       <!-- NOTE: If you need to make changes to this file, copy it to your current theme's main
       	directory so your changes won't be overwritten when the plugin is upgraded. -->
   
       <!-- Post Wrap Start-->
       <div class="post hentry ivycat-post">
   
       	<!-- 	This outputs the post TITLE -->
       	<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
   
       	<!-- 	This outputs the post EXCERPT.  To display full content including images and html,
       		replace the_excerpt(); with the_content();  below. -->
       	<div class="entry-summary">
       		<?php the_content(); ?>
       	</div>
   
       	<!--	This outputs the post META information -->
       	<div class="entry-utility">
       		<?php
       		/* translators: used between list items, there is a space after the comma. */
       		$categories_list = get_the_category_list( __( ', ', 'posts-in-page' ) );
       		if ( $categories_list ) :
       			?>
       			<span class="cat-links">
       				<?php
       				printf(
       					/* translators: 1: posted in label. 2: list of categories. */
       					'<span class="entry-utility-prep entry-utility-prep-cat-links">%1$s</span> %2$s',
       					esc_html__( 'Posted in', 'posts-in-page' ),
       					$categories_list // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
       				);
       				?>
       			</span>
       			<span class="meta-sep">|</span>
       		<?php endif; ?>
       		<?php
       		/* translators: used between list items, there is a space after the comma. */
       		$tags_list = get_the_tag_list( '', __( ', ', 'posts-in-page' ) );
       		if ( $tags_list ) :
       			?>
       			<span class="tag-links">
       				<?php
       				printf(
       					/* translators: 1: tagged label. 2: list of tags. */
       					'<span class="entry-utility-prep entry-utility-prep-tag-links">%1$s</span> %2$s',
       					esc_html__( 'Tagged', 'posts-in-page' ),
       					$tags_list // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
       				);
       				?>
       			</span>
       			<span class="meta-sep">|</span>
       		<?php endif; ?>
       		<span class="comments-link">
       			<?php
       			comments_popup_link(
       				esc_html__( 'Leave a comment', 'posts-in-page' ),
       				esc_html__( '1 Comment', 'posts-in-page' ),
       				esc_html__( '% Comments', 'posts-in-page' )
       			);
       			?>
       		</span>
       		<?php edit_post_link( esc_html__( 'Edit', 'posts-in-page' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
       	</div>
       </div>
       <!-- // Post Wrap End -->
       ```
   

Viewing 1 replies (of 1 total)

 *  [Priyank Patel](https://wordpress.org/support/users/priyankkpatel/)
 * (@priyankkpatel)
 * [3 years ago](https://wordpress.org/support/topic/inserting-a-post-that-inserts-another-post-causes-infinite-loop/#post-16815372)
 * Hi [@calioptrix](https://wordpress.org/support/users/calioptrix/) ,
   As I understood,
   you added the short-code to list out posts on a page, and those posts are having
   another short-code to list out some other posts, and there it is breaking.Am 
   I right? If yes, We will try to generate the issue from our end and get back 
   to you here.Please provide some time for the same.Thanks,Team IvyCat
    -  This reply was modified 3 years ago by [Priyank Patel](https://wordpress.org/support/users/priyankkpatel/).

Viewing 1 replies (of 1 total)

The topic ‘inserting a post that inserts another post causes infinite loop’ is closed
to new replies.

 * ![](https://ps.w.org/posts-in-page/assets/icon-256x256.png?rev=1596190)
 * [Posts in Page](https://wordpress.org/plugins/posts-in-page/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/posts-in-page/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/posts-in-page/)
 * [Active Topics](https://wordpress.org/support/plugin/posts-in-page/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/posts-in-page/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/posts-in-page/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Priyank Patel](https://wordpress.org/support/users/priyankkpatel/)
 * Last activity: [3 years ago](https://wordpress.org/support/topic/inserting-a-post-that-inserts-another-post-causes-infinite-loop/#post-16815372)
 * Status: not resolved