Pods – Custom Content Types and Fields - Version 2.9.10.2

Version Description

  • December 14th, 2022 =

  • Fixed: The new pods_get_instance() function now correctly checks if the $pod object is set up before calling methods on it. (@lkraav, @sc0ttkclark)

  • Fixed: Properly support REST API namespace customizations for Post Types and Taxonomies. (@sc0ttkclark)

Download this release

Release Info

Developer sc0ttkclark
Plugin Icon 128x128 Pods – Custom Content Types and Fields
Version 2.9.10.2
Comparing to
See all releases

Code changes from version 2.9.10.1 to 2.9.10.2

Files changed (5) hide show
  1. changelog.txt +5 -0
  2. classes/PodsInit.php +34 -0
  3. includes/classes.php +8 -1
  4. init.php +2 -2
  5. readme.txt +6 -1
changelog.txt CHANGED
@@ -2,6 +2,11 @@ Found a bug? Have a great feature idea? Get on GitHub and tell us about it and w
2
 
3
  Our GitHub has the full list of all prior releases of Pods: https://github.com/pods-framework/pods/releases
4
 
 
 
 
 
 
5
  = 2.9.10.1 - December 13th, 2022 =
6
 
7
  * Fixed: WP_Error class usage within namespace needed to be identified correctly for `\Pods\Pod_Manager`. (@lkraav, @sc0ttkclark)
2
 
3
  Our GitHub has the full list of all prior releases of Pods: https://github.com/pods-framework/pods/releases
4
 
5
+ = 2.9.10.2 - December 14th, 2022 =
6
+
7
+ * Fixed: The new `pods_get_instance()` function now correctly checks if the `$pod` object is set up before calling methods on it. (@lkraav, @sc0ttkclark)
8
+ * Fixed: Properly support REST API namespace customizations for Post Types and Taxonomies. (@sc0ttkclark)
9
+
10
  = 2.9.10.1 - December 13th, 2022 =
11
 
12
  * Fixed: WP_Error class usage within namespace needed to be identified correctly for `\Pods\Pod_Manager`. (@lkraav, @sc0ttkclark)
classes/PodsInit.php CHANGED
@@ -1561,9 +1561,26 @@ class PodsInit {
1561
  if ( $rest_enabled ) {
1562
  $rest_base = sanitize_title( pods_v( 'rest_base', $post_type, $post_type_name ) );
1563
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1564
  $pods_post_types[ $post_type_name ]['show_in_rest'] = true;
1565
  $pods_post_types[ $post_type_name ]['rest_base'] = $rest_base;
1566
  $pods_post_types[ $post_type_name ]['rest_controller_class'] = 'WP_REST_Posts_Controller';
 
 
 
 
1567
  }
1568
 
1569
  // YARPP doesn't use 'supports' array option (yet)
@@ -1751,9 +1768,26 @@ class PodsInit {
1751
  if ( $rest_enabled ) {
1752
  $rest_base = sanitize_title( pods_v( 'rest_base', $taxonomy, $taxonomy_name ) );
1753
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1754
  $pods_taxonomies[ $taxonomy_name ]['show_in_rest'] = true;
1755
  $pods_taxonomies[ $taxonomy_name ]['rest_base'] = $rest_base;
1756
  $pods_taxonomies[ $taxonomy_name ]['rest_controller_class'] = 'WP_REST_Terms_Controller';
 
 
 
 
1757
  }
1758
 
1759
  // Integration for Single Value Taxonomy UI
1561
  if ( $rest_enabled ) {
1562
  $rest_base = sanitize_title( pods_v( 'rest_base', $post_type, $post_type_name ) );
1563
 
1564
+ $rest_namespace = pods_v( 'rest_namespace', $post_type );
1565
+
1566
+ // Get the namespace and sanitize/clean up the path.
1567
+ if ( $rest_namespace ) {
1568
+ $rest_namespace = str_replace( '\\', '/', $rest_namespace );
1569
+ $rest_namespace = explode( '/', $rest_namespace );
1570
+ $rest_namespace = array_map( 'sanitize_title', $rest_namespace );
1571
+ $rest_namespace = array_filter( $rest_namespace );
1572
+ $rest_namespace = pods_trim( $rest_namespace );
1573
+ $rest_namespace = implode( '/', $rest_namespace );
1574
+ $rest_namespace = trim( $rest_namespace, '/' );
1575
+ }
1576
+
1577
  $pods_post_types[ $post_type_name ]['show_in_rest'] = true;
1578
  $pods_post_types[ $post_type_name ]['rest_base'] = $rest_base;
1579
  $pods_post_types[ $post_type_name ]['rest_controller_class'] = 'WP_REST_Posts_Controller';
1580
+
1581
+ if ( $rest_namespace ) {
1582
+ $pods_post_types[ $post_type_name ]['rest_namespace'] = $rest_namespace;
1583
+ }
1584
  }
1585
 
1586
  // YARPP doesn't use 'supports' array option (yet)
1768
  if ( $rest_enabled ) {
1769
  $rest_base = sanitize_title( pods_v( 'rest_base', $taxonomy, $taxonomy_name ) );
1770
 
1771
+ $rest_namespace = pods_v( 'rest_namespace', $taxonomy );
1772
+
1773
+ // Get the namespace and sanitize/clean up the path.
1774
+ if ( $rest_namespace ) {
1775
+ $rest_namespace = str_replace( '\\', '/', $rest_namespace );
1776
+ $rest_namespace = explode( '/', $rest_namespace );
1777
+ $rest_namespace = array_map( 'sanitize_title', $rest_namespace );
1778
+ $rest_namespace = array_filter( $rest_namespace );
1779
+ $rest_namespace = pods_trim( $rest_namespace );
1780
+ $rest_namespace = implode( '/', $rest_namespace );
1781
+ $rest_namespace = trim( $rest_namespace, '/' );
1782
+ }
1783
+
1784
  $pods_taxonomies[ $taxonomy_name ]['show_in_rest'] = true;
1785
  $pods_taxonomies[ $taxonomy_name ]['rest_base'] = $rest_base;
1786
  $pods_taxonomies[ $taxonomy_name ]['rest_controller_class'] = 'WP_REST_Terms_Controller';
1787
+
1788
+ if ( $rest_namespace ) {
1789
+ $pods_taxonomies[ $taxonomy_name ]['rest_namespace'] = $rest_namespace;
1790
+ }
1791
  }
1792
 
1793
  // Integration for Single Value Taxonomy UI
includes/classes.php CHANGED
@@ -76,7 +76,14 @@ function pods_get_instance( $type = null, $id = null, $strict = null ) {
76
  $strict = pods_strict();
77
  }
78
 
79
- if ( true === $strict && null !== $type && ! $pod->valid() ) {
 
 
 
 
 
 
 
80
  return false;
81
  }
82
 
76
  $strict = pods_strict();
77
  }
78
 
79
+ if (
80
+ true === $strict
81
+ && null !== $type
82
+ && (
83
+ ! $pod
84
+ || ! $pod->valid()
85
+ )
86
+ ) {
87
  return false;
88
  }
89
 
init.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: Pods - Custom Content Types and Fields
11
  * Plugin URI: https://pods.io/
12
  * Description: Pods is a framework for creating, managing, and deploying customized content types and fields
13
- * Version: 2.9.10.1
14
  * Author: Pods Framework Team
15
  * Author URI: https://pods.io/about/
16
  * Text Domain: pods
@@ -43,7 +43,7 @@ if ( defined( 'PODS_VERSION' ) || defined( 'PODS_DIR' ) ) {
43
  add_action( 'init', 'pods_deactivate_pods_ui' );
44
  } else {
45
  // Current version.
46
- define( 'PODS_VERSION', '2.9.10.1' );
47
 
48
  // Current database version, this is the last version the database changed.
49
  define( 'PODS_DB_VERSION', '2.3.5' );
10
  * Plugin Name: Pods - Custom Content Types and Fields
11
  * Plugin URI: https://pods.io/
12
  * Description: Pods is a framework for creating, managing, and deploying customized content types and fields
13
+ * Version: 2.9.10.2
14
  * Author: Pods Framework Team
15
  * Author URI: https://pods.io/about/
16
  * Text Domain: pods
43
  add_action( 'init', 'pods_deactivate_pods_ui' );
44
  } else {
45
  // Current version.
46
+ define( 'PODS_VERSION', '2.9.10.2' );
47
 
48
  // Current database version, this is the last version the database changed.
49
  define( 'PODS_DB_VERSION', '2.3.5' );
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: pods, custom post types, custom taxonomies, content types, custom fields,
5
  Requires at least: 5.7
6
  Tested up to: 6.1
7
  Requires PHP: 5.6
8
- Stable tag: 2.9.10.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -173,6 +173,11 @@ Pods really wouldn't be where it is without all the contributions from our [dono
173
 
174
  == Changelog ==
175
 
 
 
 
 
 
176
  = 2.9.10.1 - December 13th, 2022 =
177
 
178
  * Fixed: WP_Error class usage within namespace needed to be identified correctly for `\Pods\Pod_Manager`. (@lkraav, @sc0ttkclark)
5
  Requires at least: 5.7
6
  Tested up to: 6.1
7
  Requires PHP: 5.6
8
+ Stable tag: 2.9.10.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
173
 
174
  == Changelog ==
175
 
176
+ = 2.9.10.2 - December 14th, 2022 =
177
+
178
+ * Fixed: The new `pods_get_instance()` function now correctly checks if the `$pod` object is set up before calling methods on it. (@lkraav, @sc0ttkclark)
179
+ * Fixed: Properly support REST API namespace customizations for Post Types and Taxonomies. (@sc0ttkclark)
180
+
181
  = 2.9.10.1 - December 13th, 2022 =
182
 
183
  * Fixed: WP_Error class usage within namespace needed to be identified correctly for `\Pods\Pod_Manager`. (@lkraav, @sc0ttkclark)