Title: Nested inserts possible?
Last modified: March 13, 2017

---

# Nested inserts possible?

 *  Resolved [greglfb](https://wordpress.org/support/users/greglfb/)
 * (@greglfb)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/nested-inserts-possible/)
 * I’m finding the plugin doesn’t seem to like nested inserts.
 * E.g., If I insert page C into page B, then insert page B into Page A, then Page
   A shows all of page B _except _the page C insertion. Can I get around this in
   settings, or is this a limitation of the plugin?
 * Must add… I LOVE this plugin – it’s transformed my workflow, and I couldn’t do
   without it!
    Just upgraded to WP 4.7.3 and no problems so far.

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Paul Ryan](https://wordpress.org/support/users/figureone/)
 * (@figureone)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/nested-inserts-possible/#post-8909271)
 * Howdy, right now it is possible with a hook that you can throw into your theme.
   By default, nested inserts are disabled to prevent someone accidentally inserted
   page A into page B and then inserting page B into page A (circular loop).
 * In your theme, if you already have a function that hooks into `init`, just add
   this filter hook to disable the nesting check for the plugin:
 *     ```
       // Disable nesting check to allow inserted pages within inserted pages.
       add_filter( 'insert_pages_apply_nesting_check', '__return_false' );
       ```
   
 * If you don’t have or can’t find an existing function that hooks into `init`, 
   just put one into your theme’s functions.php file:
 *     ```
       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' );
       ```
   
 * At some point I should just make this a configurable option on the Settings page
   for the plugin so you don’t have to add any code. Will let you know if that happens!
 *  Thread Starter [greglfb](https://wordpress.org/support/users/greglfb/)
 * (@greglfb)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/nested-inserts-possible/#post-8909366)
 * Thanks very much for this. I’ll give it a try!
 *  Thread Starter [greglfb](https://wordpress.org/support/users/greglfb/)
 * (@greglfb)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/nested-inserts-possible/#post-8909703)
 * I couldn’t get it to work, but this is almost certainly because I’m a complete
   WordPress noob and edited the wrong file or something!
    I’ve realised that I 
   can get around my immediate problem by rethinking the way I’ve used the plugin
   in its unmodified form, which just goes to show how useful it is out of the box.
   Thanks very much for the advice.
 *  Thread Starter [greglfb](https://wordpress.org/support/users/greglfb/)
 * (@greglfb)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/nested-inserts-possible/#post-8923194)
 * Help! I’ve posted a question about an unrelated but urgent (as in site-killing)
   problem, but it’s been put in a 72-hour moderation queue for some reason.
 * EDIT: Post is visible now. 🙂
    -  This reply was modified 9 years, 2 months ago by [greglfb](https://wordpress.org/support/users/greglfb/).
 *  [Haim](https://wordpress.org/support/users/koostamas/)
 * (@koostamas)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/nested-inserts-possible/#post-9013712)
 * Hello!
 * I used to use this solution in the past:
 * > ============ Add after:
   >  add_action( ‘after_setup_theme’, ‘spacious_setup’ );
   > ============ these lines:
   >  // ****START******** for Insert Pages plugin
   >  function theme_init() { // Disable
   > nesting check to allow inserted pages within inserted pages. add_filter( ‘insert_pages_apply_nesting_check’,
   > function ( $should_apply ) { return false; } ); } add_action( ‘init’, ‘theme_init’);//****
   > END******** for Insert Pages plugin
 * Now it makes an error with these lines, and without them the nesting would not
   work.
 * I am using WP 4.4.8, Insert Page 3.1.8, Spacious theme 1.4.5.
 * Please, help. How may this be resolved.
 * Thanks a lot!
 * Tamás
 * p.s.
    I use Insert Page since a long time, and I just love it, and rely on it
   a lot.
 *  [Haim](https://wordpress.org/support/users/koostamas/)
 * (@koostamas)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/nested-inserts-possible/#post-9013768)
 * Hello, again!
 * In the meantime I added what Paul suggested into the function.php
    as follows:
 * >  // ****START******** for Insert Pages plugin
   >  function spacious_init() { //
   > Disable nesting check to allow inserted pages within inserted pages. add_filter(‘
   > insert_pages_apply_nesting_check’, ‘__return_false’ ); } add_action( ‘init’,‘
   > spacious_init’ ); // ****END******** for Insert Pages plugin
 * And with these lines it seems to work!
 * Thanks, Paul!
    Great stuff! I love it.
 * Greetings,
 * Tamás
 *  Plugin Author [Paul Ryan](https://wordpress.org/support/users/figureone/)
 * (@figureone)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/nested-inserts-possible/#post-9050751)
 * Glad you got it working! The problem with the other code was probably using an
   older PHP version that didn’t support anonymous functions (older than PHP 5.3,
   I think).
    [http://php.net/manual/en/functions.anonymous.php](http://php.net/manual/en/functions.anonymous.php)

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Nested inserts possible?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/insert-pages.svg)
 * [Insert Pages](https://wordpress.org/plugins/insert-pages/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-pages/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-pages/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-pages/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-pages/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-pages/reviews/)

## Tags

 * [embed](https://wordpress.org/support/topic-tag/embed/)
 * [insert Page](https://wordpress.org/support/topic-tag/insert-page/)

 * 7 replies
 * 3 participants
 * Last reply from: [Paul Ryan](https://wordpress.org/support/users/figureone/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/nested-inserts-possible/#post-9050751)
 * Status: resolved