Insert Pages - Version 3.4.5

Version Description

  • Fix for nested inserted pages all using custom templates. Props @masterbip for discovering the issue!
Download this release

Release Info

Developer figureone
Plugin Icon wp plugin Insert Pages
Version 3.4.5
Comparing to
See all releases

Code changes from version 3.4.4 to 3.4.5

Files changed (2) hide show
  1. insert-pages.php +19 -3
  2. readme.txt +4 -1
insert-pages.php CHANGED
@@ -7,7 +7,7 @@
7
  * Text Domain: insert-pages
8
  * Domain Path: /languages
9
  * License: GPL2
10
- * Version: 3.4.4
11
  *
12
  * @package insert-pages
13
  */
@@ -549,6 +549,12 @@ if ( ! class_exists( 'InsertPagesPlugin' ) ) {
549
  'post_type' => get_post_types(),
550
  );
551
  }
 
 
 
 
 
 
552
  $inserted_page = query_posts( $args );
553
  if ( have_posts() ) {
554
  $template = locate_template( $attributes['display'] );
@@ -571,7 +577,9 @@ if ( ! class_exists( 'InsertPagesPlugin' ) ) {
571
  <?php
572
  }
573
  }
574
- wp_reset_query();
 
 
575
  }
576
 
577
  // Save output buffer contents.
@@ -593,6 +601,12 @@ if ( ! class_exists( 'InsertPagesPlugin' ) ) {
593
  'post_status' => $attributes['public'] ? array( 'publish', 'private' ) : array( 'publish' ),
594
  );
595
  }
 
 
 
 
 
 
596
  $posts = query_posts( $args );
597
  if ( have_posts() ) {
598
  // Start output buffering so we can save the output to string.
@@ -799,7 +813,9 @@ if ( ! class_exists( 'InsertPagesPlugin' ) ) {
799
  */
800
  $content = apply_filters( 'insert_pages_not_found_message', $content );
801
  }
802
- wp_reset_query();
 
 
803
  }
804
 
805
  /**
7
  * Text Domain: insert-pages
8
  * Domain Path: /languages
9
  * License: GPL2
10
+ * Version: 3.4.5
11
  *
12
  * @package insert-pages
13
  */
549
  'post_type' => get_post_types(),
550
  );
551
  }
552
+ // We save the previous query state here instead of using
553
+ // wp_reset_query() because wp_reset_query() only has a single stack
554
+ // variable ($GLOBALS['wp_the_query']). This allows us to support
555
+ // pages inserted into other pages (multiple nested pages, which
556
+ // requires insert_pages_apply_nesting_check to be turned off).
557
+ $old_query = $GLOBALS['wp_query'];
558
  $inserted_page = query_posts( $args );
559
  if ( have_posts() ) {
560
  $template = locate_template( $attributes['display'] );
577
  <?php
578
  }
579
  }
580
+ // Restore previous query and update the global template variables.
581
+ $GLOBALS['wp_query'] = $old_query;
582
+ wp_reset_postdata();
583
  }
584
 
585
  // Save output buffer contents.
601
  'post_status' => $attributes['public'] ? array( 'publish', 'private' ) : array( 'publish' ),
602
  );
603
  }
604
+ // We save the previous query state here instead of using
605
+ // wp_reset_query() because wp_reset_query() only has a single stack
606
+ // variable ($GLOBALS['wp_the_query']). This allows us to support
607
+ // pages inserted into other pages (multiple nested pages, which
608
+ // requires insert_pages_apply_nesting_check to be turned off).
609
+ $old_query = $GLOBALS['wp_query'];
610
  $posts = query_posts( $args );
611
  if ( have_posts() ) {
612
  // Start output buffering so we can save the output to string.
813
  */
814
  $content = apply_filters( 'insert_pages_not_found_message', $content );
815
  }
816
+ // Restore previous query and update the global template variables.
817
+ $GLOBALS['wp_query'] = $old_query;
818
+ wp_reset_postdata();
819
  }
820
 
821
  /**
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: figureone, the_magician
3
  Tags: insert, pages, shortcode, embed
4
  Requires at least: 3.0.1
5
- Tested up to: 4.9.5
6
  Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -86,6 +86,9 @@ Just one! The plugin prevents you from embedding a page in itself, but you can t
86
 
87
  == Changelog ==
88
 
 
 
 
89
  = 3.4.4 =
90
  * Fix incorrect link in excerpt's 'Continue reading' link. Props @bogyo74 for discovering the bug!
91
  * Fix empty id attribute rendering if no custom ID provided. Props @theschappy for finding and fixing this bug!
2
  Contributors: figureone, the_magician
3
  Tags: insert, pages, shortcode, embed
4
  Requires at least: 3.0.1
5
+ Tested up to: 5.0.3
6
  Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
86
 
87
  == Changelog ==
88
 
89
+ = 3.4.5 =
90
+ * Fix for nested inserted pages all using custom templates. Props @masterbip for discovering the issue!
91
+
92
  = 3.4.4 =
93
  * Fix incorrect link in excerpt's 'Continue reading' link. Props @bogyo74 for discovering the bug!
94
  * Fix empty id attribute rendering if no custom ID provided. Props @theschappy for finding and fixing this bug!