Custom Post Type UI - Version 1.5.3

Version Description

  • 2017-03-29 =
  • Fixed: Removed ability to rename post type and taxonomy slugs to reserved slugs after initial saving.
  • Updated: Updated existing and added new, fancier side graphics.
Download this release

Release Info

Developer tw2113
Plugin Icon 128x128 Custom Post Type UI
Version 1.5.3
Comparing to
See all releases

Code changes from version 1.5.2 to 1.5.3

custom-post-type-ui.php CHANGED
@@ -15,7 +15,7 @@ Plugin Name: Custom Post Type UI
15
  Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
16
  Description: Admin panel for creating custom post types and custom taxonomies in WordPress
17
  Author: WebDevStudios
18
- Version: 1.5.2
19
  Author URI: https://webdevstudios.com/
20
  Text Domain: custom-post-type-ui
21
  Domain Path: /languages
@@ -27,8 +27,8 @@ if ( ! defined( 'ABSPATH' ) ) {
27
  exit;
28
  }
29
 
30
- define( 'CPT_VERSION', '1.5.2' ); // Left for legacy purposes.
31
- define( 'CPTUI_VERSION', '1.5.2' );
32
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
33
 
34
  /**
15
  Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
16
  Description: Admin panel for creating custom post types and custom taxonomies in WordPress
17
  Author: WebDevStudios
18
+ Version: 1.5.3
19
  Author URI: https://webdevstudios.com/
20
  Text Domain: custom-post-type-ui
21
  Domain Path: /languages
27
  exit;
28
  }
29
 
30
+ define( 'CPT_VERSION', '1.5.3' ); // Left for legacy purposes.
31
+ define( 'CPTUI_VERSION', '1.5.3' );
32
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
33
 
34
  /**
images/wds_ads/apppresser.png DELETED
Binary file
images/wds_ads/buddypages.png ADDED
Binary file
images/wds_ads/cptui-extended.png ADDED
Binary file
images/wds_ads/cptuix-ad-3.png DELETED
Binary file
images/wds_ads/instago.png ADDED
Binary file
images/wds_ads/maintainn.png CHANGED
Binary file
inc/post-types.php CHANGED
@@ -1192,7 +1192,13 @@ function cptui_get_current_post_type( $post_type_deleted = false ) {
1192
  $post_types = cptui_get_post_type_data();
1193
  $type = key( $post_types );
1194
  } else if ( isset( $_POST['cpt_custom_post_type']['name'] ) ) {
1195
- $type = sanitize_text_field( $_POST['cpt_custom_post_type']['name'] );
 
 
 
 
 
 
1196
  }
1197
  } else if ( ! empty( $_GET ) && isset( $_GET['cptui_post_type'] ) ) {
1198
  $type = sanitize_text_field( $_GET['cptui_post_type'] );
@@ -1350,15 +1356,13 @@ function cptui_update_post_type( $data = array() ) {
1350
  */
1351
  $slug_exists = apply_filters( 'cptui_post_type_slug_exists', false, $data['cpt_custom_post_type']['name'], $post_types );
1352
  $slug_as_page = cptui_check_page_slugs( $data['cpt_custom_post_type']['name'] );
1353
- if ( 'new' == $data['cpt_type_status'] ) {
1354
- if ( true === $slug_exists ) {
1355
- add_filter( 'cptui_custom_error_message', 'cptui_slug_matches_post_type' );
1356
- return 'error';
1357
- }
1358
- if ( true === $slug_as_page ) {
1359
- add_filter( 'cptui_custom_error_message', 'cptui_slug_matches_page' );
1360
- return 'error';
1361
- }
1362
  }
1363
 
1364
  if ( empty( $data['cpt_addon_taxes'] ) || ! is_array( $data['cpt_addon_taxes'] ) ) {
@@ -1666,3 +1670,26 @@ function cptui_do_convert_post_type_posts() {
1666
  }
1667
  }
1668
  add_action( 'init', 'cptui_do_convert_post_type_posts' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1192
  $post_types = cptui_get_post_type_data();
1193
  $type = key( $post_types );
1194
  } else if ( isset( $_POST['cpt_custom_post_type']['name'] ) ) {
1195
+ // Return the submitted value.
1196
+ if ( ! in_array( $_POST['cpt_custom_post_type']['name'], cptui_reserved_post_types(), true ) ) {
1197
+ $type = sanitize_text_field( $_POST['cpt_custom_post_type']['name'] );
1198
+ } else {
1199
+ // Return the original value since user tried to submit a reserved term.
1200
+ $type = sanitize_text_field( $_POST['cpt_original'] );
1201
+ }
1202
  }
1203
  } else if ( ! empty( $_GET ) && isset( $_GET['cptui_post_type'] ) ) {
1204
  $type = sanitize_text_field( $_GET['cptui_post_type'] );
1356
  */
1357
  $slug_exists = apply_filters( 'cptui_post_type_slug_exists', false, $data['cpt_custom_post_type']['name'], $post_types );
1358
  $slug_as_page = cptui_check_page_slugs( $data['cpt_custom_post_type']['name'] );
1359
+ if ( true === $slug_exists ) {
1360
+ add_filter( 'cptui_custom_error_message', 'cptui_slug_matches_post_type' );
1361
+ return 'error';
1362
+ }
1363
+ if ( true === $slug_as_page ) {
1364
+ add_filter( 'cptui_custom_error_message', 'cptui_slug_matches_page' );
1365
+ return 'error';
 
 
1366
  }
1367
 
1368
  if ( empty( $data['cpt_addon_taxes'] ) || ! is_array( $data['cpt_addon_taxes'] ) ) {
1670
  }
1671
  }
1672
  add_action( 'init', 'cptui_do_convert_post_type_posts' );
1673
+
1674
+ /**
1675
+ * Handles slug_exist checks for cases of editing an existing post type.
1676
+ *
1677
+ * @since 1.5.3
1678
+ *
1679
+ * @param bool $slug_exists Current status for exist checks.
1680
+ * @param string $post_type_slug Post type slug being processed.
1681
+ * @param array $post_types CPTUI post types.
1682
+ * @return bool
1683
+ */
1684
+ function cptui_updated_post_type_slug_exists( $slug_exists, $post_type_slug = '', $post_types = array() ) {
1685
+ if (
1686
+ ( ! empty( $_POST['cpt_type_status'] ) && 'edit' == $_POST['cpt_type_status'] ) &&
1687
+ ! in_array( $post_type_slug, cptui_reserved_taxonomies() ) &&
1688
+ ( ! empty( $_POST['cpt_original'] ) && $post_type_slug === $_POST['cpt_original'] )
1689
+ )
1690
+ {
1691
+ $slug_exists = false;
1692
+ }
1693
+ return $slug_exists;
1694
+ }
1695
+ add_filter( 'cptui_post_type_slug_exists', 'cptui_updated_post_type_slug_exists', 11, 3 );
inc/taxonomies.php CHANGED
@@ -963,7 +963,13 @@ function cptui_get_current_taxonomy( $taxonomy_deleted = false ) {
963
  $taxonomies = cptui_get_taxonomy_data();
964
  $tax = key( $taxonomies );
965
  } else if ( isset( $_POST['cpt_custom_tax']['name'] ) ) {
966
- $tax = sanitize_text_field( $_POST['cpt_custom_tax']['name'] );
 
 
 
 
 
 
967
  }
968
  } else if ( ! empty( $_GET ) && isset( $_GET['cptui_taxonomy'] ) ) {
969
  $tax = sanitize_text_field( $_GET['cptui_taxonomy'] );
@@ -1122,11 +1128,9 @@ function cptui_update_taxonomy( $data = array() ) {
1122
  * @param array $post_types Array of existing post types from CPTUI.
1123
  */
1124
  $slug_exists = apply_filters( 'cptui_taxonomy_slug_exists', false, $data['cpt_custom_tax']['name'], $taxonomies );
1125
- if ( 'new' == $data['cpt_tax_status'] ) {
1126
- if ( true === $slug_exists ) {
1127
- add_filter( 'cptui_custom_error_message', 'cptui_slug_matches_taxonomy' );
1128
- return 'error';
1129
- }
1130
  }
1131
 
1132
  foreach ( $data['cpt_tax_labels'] as $key => $label ) {
@@ -1464,3 +1468,26 @@ function cptui_do_convert_taxonomy_terms() {
1464
  }
1465
  }
1466
  add_action( 'init', 'cptui_do_convert_taxonomy_terms' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
963
  $taxonomies = cptui_get_taxonomy_data();
964
  $tax = key( $taxonomies );
965
  } else if ( isset( $_POST['cpt_custom_tax']['name'] ) ) {
966
+ // Return the submitted value.
967
+ if ( ! in_array( $_POST['cpt_custom_tax']['name'], cptui_reserved_taxonomies(), true ) ) {
968
+ $tax = sanitize_text_field( $_POST['cpt_custom_tax']['name'] );
969
+ } else {
970
+ // Return the original value since user tried to submit a reserved term.
971
+ $tax = sanitize_text_field( $_POST['tax_original'] );
972
+ }
973
  }
974
  } else if ( ! empty( $_GET ) && isset( $_GET['cptui_taxonomy'] ) ) {
975
  $tax = sanitize_text_field( $_GET['cptui_taxonomy'] );
1128
  * @param array $post_types Array of existing post types from CPTUI.
1129
  */
1130
  $slug_exists = apply_filters( 'cptui_taxonomy_slug_exists', false, $data['cpt_custom_tax']['name'], $taxonomies );
1131
+ if ( true === $slug_exists ) {
1132
+ add_filter( 'cptui_custom_error_message', 'cptui_slug_matches_taxonomy' );
1133
+ return 'error';
 
 
1134
  }
1135
 
1136
  foreach ( $data['cpt_tax_labels'] as $key => $label ) {
1468
  }
1469
  }
1470
  add_action( 'init', 'cptui_do_convert_taxonomy_terms' );
1471
+
1472
+ /**
1473
+ * Handles slug_exist checks for cases of editing an existing taxonomy.
1474
+ *
1475
+ * @since 1.5.3
1476
+ *
1477
+ * @param bool $slug_exists Current status for exist checks.
1478
+ * @param string $taxonomy_slug Taxonomy slug being processed.
1479
+ * @param array $taxonomies CPTUI taxonomies.
1480
+ * @return bool
1481
+ */
1482
+ function cptui_updated_taxonomy_slug_exists( $slug_exists, $taxonomy_slug = '', $taxonomies = array() ) {
1483
+ if (
1484
+ ( ! empty( $_POST['cpt_tax_status'] ) && 'edit' == $_POST['cpt_tax_status'] ) &&
1485
+ ! in_array( $taxonomy_slug, cptui_reserved_taxonomies() ) &&
1486
+ ( ! empty( $_POST['tax_original'] ) && $taxonomy_slug === $_POST['tax_original'] )
1487
+ )
1488
+ {
1489
+ $slug_exists = false;
1490
+ }
1491
+ return $slug_exists;
1492
+ }
1493
+ add_filter( 'cptui_taxonomy_slug_exists', 'cptui_updated_taxonomy_slug_exists', 11, 3 );
inc/utility.php CHANGED
@@ -310,7 +310,7 @@ function cptui_products_sidebar() {
310
  }
311
  printf(
312
  '<p><a href="%s">%s</a></p>',
313
- 'https://pluginize.com/plugins/custom-post-type-ui-extended/?utm_source=remove_ads&utm_medium=text&utm_campaign=cptui',
314
  esc_html__( 'Remove these ads?', 'custom-post-type-ui' )
315
  );
316
  }
@@ -398,19 +398,25 @@ function cptui_get_ads() {
398
  */
399
  function cptui_default_ads( $ads = array() ) {
400
  $ads[] = array(
401
- 'url' => 'https://pluginize.com/plugins/custom-post-type-ui-extended/?utm_source=sidebar-v3&utm_medium=banner&utm_campaign=cptui',
402
- 'image' => plugin_dir_url( dirname( __FILE__ ) ) . 'images/wds_ads/cptuix-ad-3.png',
403
  'text' => 'Custom Post Type UI Extended product ad',
404
  );
405
 
406
  $ads[] = array(
407
- 'url' => 'https://apppresser.com/?utm_source=pluginize&utm_medium=plugin&utm_campaign=cptui',
408
- 'image' => plugin_dir_url( dirname( __FILE__ ) ) . 'images/wds_ads/apppresser.png',
409
- 'text' => 'AppPresser product ad',
410
  );
411
 
412
  $ads[] = array(
413
- 'url' => 'https://maintainn.com/?utm_source=Pluginize&utm_medium=Plugin-Sidebar&utm_campaign=CPTUI',
 
 
 
 
 
 
414
  'image' => plugin_dir_url( dirname( __FILE__ ) ) . 'images/wds_ads/maintainn.png',
415
  'text' => 'Maintainn product ad',
416
  );
310
  }
311
  printf(
312
  '<p><a href="%s">%s</a></p>',
313
+ 'https://pluginize.com/plugins/custom-post-type-ui-extended/ref/pluginizeaff/?campaign=cptui-sidebar-remove',
314
  esc_html__( 'Remove these ads?', 'custom-post-type-ui' )
315
  );
316
  }
398
  */
399
  function cptui_default_ads( $ads = array() ) {
400
  $ads[] = array(
401
+ 'url' => 'https://pluginize.com/plugins/custom-post-type-ui-extended/ref/pluginizeaff/?campaign=cptui-sidebar-extended',
402
+ 'image' => plugin_dir_url( dirname( __FILE__ ) ) . 'images/wds_ads/cptui-extended.png',
403
  'text' => 'Custom Post Type UI Extended product ad',
404
  );
405
 
406
  $ads[] = array(
407
+ 'url' => 'https://pluginize.com/plugins/instago/ref/pluginizeaff/?campaign=cptui-sidebar-ig',
408
+ 'image' => plugin_dir_url( dirname( __FILE__ ) ) . 'images/wds_ads/instago.png',
409
+ 'text' => 'InstaGo product ad',
410
  );
411
 
412
  $ads[] = array(
413
+ 'url' => 'https://pluginize.com/plugins/buddypages/ref/pluginizeaff/?campaign=cptui-sidebar-buddypages',
414
+ 'image' => plugin_dir_url( dirname( __FILE__ ) ) . 'images/wds_ads/buddypages.png',
415
+ 'text' => 'BuddyPages product ad',
416
+ );
417
+
418
+ $ads[] = array(
419
+ 'url' => 'https://maintainn.com/?utm_source=Pluginize-v2&utm_medium=Plugin-Sidebar&utm_campaign=CPTUI',
420
  'image' => plugin_dir_url( dirname( __FILE__ ) ) . 'images/wds_ads/maintainn.png',
421
  'text' => 'Maintainn product ad',
422
  );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: custom post types, CPT, CMS, post, types, post type, taxonomy, tax, custom, content types, post types
5
  Requires at least: 4.6
6
  Tested up to: 4.7.2
7
- Stable tag: 1.5.2
8
  License: GPLv2
9
 
10
  Admin UI for creating custom post types and custom taxonomies for WordPress
@@ -30,6 +30,12 @@ Official development of Custom Post Type UI is on GitHub, with official stable r
30
 
31
  == Changelog ==
32
 
 
 
 
 
 
 
33
  = 1.5.2 - 2017-2-1 =
34
  * Fixed: Chrome conflicts around the js used to sanitize post type and taxonomy slugs and cursors moving to end of input.
35
  * Fixed: Further hardened undefined index notices and instance checks in our cptui_not_new_install() callback.
@@ -94,6 +100,10 @@ Official development of Custom Post Type UI is on GitHub, with official stable r
94
 
95
  == Upgrade Notice ==
96
 
 
 
 
 
97
  = 1.5.2 - 2017-2-1 =
98
  * Fixed: Chrome conflicts around the js used to sanitize post type and taxonomy slugs and cursors moving to end of input.
99
  * Fixed: Further hardened undefined index notices and instance checks in our cptui_not_new_install() callback.
@@ -178,5 +188,8 @@ That's it! Now you can easily start creating custom post types and taxonomies in
178
 
179
  == Frequently Asked Questions ==
180
 
181
- User documentation: http://docs.pluginize.com/category/126-custom-post-type-ui
182
- Code/API documentation: http://codex.pluginize.com/cptui/
 
 
 
4
  Tags: custom post types, CPT, CMS, post, types, post type, taxonomy, tax, custom, content types, post types
5
  Requires at least: 4.6
6
  Tested up to: 4.7.2
7
+ Stable tag: 1.5.3
8
  License: GPLv2
9
 
10
  Admin UI for creating custom post types and custom taxonomies for WordPress
30
 
31
  == Changelog ==
32
 
33
+ See changelog.txt for older changes.
34
+
35
+ = 1.5.3 - 2017-03-29 =
36
+ * Fixed: Removed ability to rename post type and taxonomy slugs to reserved slugs after initial saving.
37
+ * Updated: Updated existing and added new, fancier side graphics.
38
+
39
  = 1.5.2 - 2017-2-1 =
40
  * Fixed: Chrome conflicts around the js used to sanitize post type and taxonomy slugs and cursors moving to end of input.
41
  * Fixed: Further hardened undefined index notices and instance checks in our cptui_not_new_install() callback.
100
 
101
  == Upgrade Notice ==
102
 
103
+ = 1.5.3 - 2017-03-29 =
104
+ * Fixed: Removed ability to rename post type and taxonomy slugs to reserved slugs after initial saving.
105
+ * Updated: Updated existing and added new, fancier side graphics.
106
+
107
  = 1.5.2 - 2017-2-1 =
108
  * Fixed: Chrome conflicts around the js used to sanitize post type and taxonomy slugs and cursors moving to end of input.
109
  * Fixed: Further hardened undefined index notices and instance checks in our cptui_not_new_install() callback.
188
 
189
  == Frequently Asked Questions ==
190
 
191
+ #### User documentation
192
+ Please see http://docs.pluginize.com/category/126-custom-post-type-ui
193
+
194
+ #### Code/API documentation
195
+ Please see http://codex.pluginize.com/cptui/