Support » Plugin: Insert Pages » shortcode inside a page with another shortcode infinite load

  • Resolved masterbip


    Hi there. A weird issue.
    I am using this to disable “nesting check”

    function your_theme_init() {
        // Disable nesting check to allow inserted pages within inserted pages.
        add_filter( 'insert_pages_apply_nesting_check', '__return_false' );
    add_action( 'init', 'your_theme_init' );

    I got 4 pages with normal content plain short demo test text:
    1.- Index
    2.- Page-2
    3.- Page-3
    4.- Page-3-Child

    In INDEX I [Insert Page-2] and [Insert Page-3]

    Browse Index: All is fine till here.

    If in Page-3 I [Insert Page-3-Child]
    Browse Index: I got the infinite loop and the page load down infinity….

    Using a simple template:

    Template Name: Demo_Template
    while ( have_posts() ) : the_post();
    	<div class="insert-page-wrap">
    		<div class="insert-page-content">
    		<?php the_content(); ?>
    <?php endwhile; ?>

    Logically I am not nesting anything
    I got like

    Is this a normal behavior if I disable nesting check?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Paul Ryan


    Thanks for the detailed steps to reproduce. That scenario should work, we’ll look into it!

    Plugin Author Paul Ryan


    Ok, tracked down the issue. Using Custom Templates in Insert Pages relies on the old query_posts() WordPress function, which has some drawbacks. If you look at the docs, it will try to save the global $wp_query variable into a backup global variable, $wp_the_query. However, This immediately gets overwritten when you insert your nested page, so WordPress is unable to restore the original query.

    I’ve updated Insert Pages to cache it’s own version of $wp_query that we restore, which allows for nested pages all using Custom Templates.

    This fix is included in version 3.4.5, just released. Thanks for the report!



    Updating now Ill let you know.
    By the way.
    Where can I “buy you” a “coffee cup”?
    Paypal … something?




    Working perfect, THANKS! It is absolutely pure magic what we can do with your plugin!

    For real, let me buy you a Coffee Cup

    Thanks, AWESOME!!!!

    (When finished I’ll give you my project URL so you can show as portfolio -> It will be LEGENDARY!)

    Plugin Author pkarjala


    @masterbip Thank you for the feedback! We fortunately get paid to work on and support this plugin through our regular job. If you would like to add to this support, please consider a donation at



    Hi, with the new update, we still need to use this?
    add_filter( ‘insert_pages_apply_nesting_check’, ‘__return_false’ );

    You could say I’m scared of doing this and making a loop

    Plugin Author Paul Ryan


    You’ll need to add that code if you want the nesting level to go deeper than 1 (e.g., A inserted in B, B inserted in C, so when you view C, you see B including A’s content inside it). If you make a loop, you’ll probably get the WSOD when trying to load the page. Simply remove (or comment out) the code for insert_pages_apply_nesting_check, and it will go back to only allowing one level of nesting, which will prevent the loop.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.