Custom Post Type UI - Version 1.4.3

Version Description

  • 2016-10-17 =
  • Fixed: issue with post types and taxonomies trying to be converted before registration. Prevented full success of process.
  • Fixed: Prevent trying to convert taxonomy terms if no terms exist. Taxonomy will still be deleted from CPTUI list.
  • Fixed: Prevent trying to redirect on activation if being network-activated.
Download this release

Release Info

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

Code changes from version 1.4.2 to 1.4.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.4.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.4.2' ); // Left for legacy purposes.
31
- define( 'CPTUI_VERSION', '1.4.2' );
32
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
33
 
34
  /**
@@ -51,7 +51,7 @@ add_action( 'init', 'cptui_load_ui_class' );
51
  */
52
  function cptui_activation_redirect() {
53
  // Bail if activating from network, or bulk.
54
- if ( isset( $_GET['activate-multi'] ) ) {
55
  return;
56
  }
57
 
@@ -74,7 +74,7 @@ function cptui_make_activation_redirect() {
74
  delete_transient( 'cptui_activation_redirect' );
75
 
76
  // Bail if activating from network, or bulk.
77
- if ( isset( $_GET['activate-multi'] ) ) {
78
  return;
79
  }
80
 
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.4.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.4.3' ); // Left for legacy purposes.
31
+ define( 'CPTUI_VERSION', '1.4.3' );
32
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
33
 
34
  /**
51
  */
52
  function cptui_activation_redirect() {
53
  // Bail if activating from network, or bulk.
54
+ if ( is_network_admin() ) {
55
  return;
56
  }
57
 
74
  delete_transient( 'cptui_activation_redirect' );
75
 
76
  // Bail if activating from network, or bulk.
77
+ if ( is_network_admin() ) {
78
  return;
79
  }
80
 
images/cptui-icon-128x128.png ADDED
Binary file
inc/post-types.php CHANGED
@@ -1299,7 +1299,7 @@ function cptui_update_post_type( $data = array() ) {
1299
 
1300
  if ( ! empty( $data['cpt_original'] ) && $data['cpt_original'] != $data['cpt_custom_post_type']['name'] ) {
1301
  if ( ! empty( $data['update_post_types'] ) ) {
1302
- cptui_convert_post_type_posts( $data['cpt_original'], $data['cpt_custom_post_type']['name'] );
1303
  }
1304
  }
1305
 
@@ -1627,3 +1627,25 @@ function cptui_process_post_type() {
1627
  }
1628
  }
1629
  add_action( 'init', 'cptui_process_post_type', 8 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1299
 
1300
  if ( ! empty( $data['cpt_original'] ) && $data['cpt_original'] != $data['cpt_custom_post_type']['name'] ) {
1301
  if ( ! empty( $data['update_post_types'] ) ) {
1302
+ add_filter( 'cptui_convert_post_type_posts', '__return_true' );
1303
  }
1304
  }
1305
 
1627
  }
1628
  }
1629
  add_action( 'init', 'cptui_process_post_type', 8 );
1630
+
1631
+ /**
1632
+ * Handle the conversion of post type posts.
1633
+ *
1634
+ * This function came to be because we needed to convert AFTER registration.
1635
+ *
1636
+ * @since 1.4.3
1637
+ */
1638
+ function cptui_do_convert_post_type_posts() {
1639
+
1640
+ /**
1641
+ * Whether or not to convert post type posts.
1642
+ *
1643
+ * @since 1.4.3
1644
+ *
1645
+ * @param bool $value Whether or not to convert.
1646
+ */
1647
+ if ( apply_filters( 'cptui_convert_post_type_posts', false ) ) {
1648
+ cptui_convert_post_type_posts( sanitize_text_field( $_POST['cpt_original'] ), sanitize_text_field( $_POST['cpt_custom_post_type']['name'] ) );
1649
+ }
1650
+ }
1651
+ add_action( 'init', 'cptui_do_convert_post_type_posts' );
inc/taxonomies.php CHANGED
@@ -1089,7 +1089,7 @@ function cptui_update_taxonomy( $data = array() ) {
1089
 
1090
  if ( ! empty( $data['tax_original'] ) && $data['tax_original'] != $data['cpt_custom_tax']['name'] ) {
1091
  if ( ! empty( $data['update_taxonomy'] ) ) {
1092
- cptui_convert_taxonomy_terms( $data['tax_original'], $data['cpt_custom_tax']['name'] );
1093
  }
1094
  }
1095
 
@@ -1349,13 +1349,19 @@ function cptui_convert_taxonomy_terms( $original_slug = '', $new_slug = '' ) {
1349
 
1350
  $term_ids = get_terms( $original_slug, $args );
1351
 
1352
- $term_ids = implode( ',', $term_ids );
 
 
1353
 
1354
- $query = "UPDATE `{$wpdb->term_taxonomy}` SET `taxonomy` = %s WHERE `taxonomy` = %s AND `term_id` IN ( {$term_ids} )";
 
1355
 
1356
- $wpdb->query(
1357
- $wpdb->prepare( $query, $new_slug, $original_slug )
1358
- );
 
 
 
1359
  cptui_delete_taxonomy( $original_slug );
1360
  }
1361
 
@@ -1433,3 +1439,25 @@ function cptui_process_taxonomy() {
1433
  }
1434
  }
1435
  add_action( 'init', 'cptui_process_taxonomy', 8 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1089
 
1090
  if ( ! empty( $data['tax_original'] ) && $data['tax_original'] != $data['cpt_custom_tax']['name'] ) {
1091
  if ( ! empty( $data['update_taxonomy'] ) ) {
1092
+ add_filter( 'cptui_convert_taxonomy_terms', '__return_true' );
1093
  }
1094
  }
1095
 
1349
 
1350
  $term_ids = get_terms( $original_slug, $args );
1351
 
1352
+ if ( is_int( $term_ids ) ) {
1353
+ $term_ids = (array) $term_ids;
1354
+ }
1355
 
1356
+ if ( is_array( $term_ids ) && ! empty( $term_ids ) ) {
1357
+ $term_ids = implode( ',', $term_ids );
1358
 
1359
+ $query = "UPDATE `{$wpdb->term_taxonomy}` SET `taxonomy` = %s WHERE `taxonomy` = %s AND `term_id` IN ( {$term_ids} )";
1360
+
1361
+ $wpdb->query(
1362
+ $wpdb->prepare( $query, $new_slug, $original_slug )
1363
+ );
1364
+ }
1365
  cptui_delete_taxonomy( $original_slug );
1366
  }
1367
 
1439
  }
1440
  }
1441
  add_action( 'init', 'cptui_process_taxonomy', 8 );
1442
+
1443
+ /**
1444
+ * Handle the conversion of taxonomy terms.
1445
+ *
1446
+ * This function came to be because we needed to convert AFTER registration.
1447
+ *
1448
+ * @since 1.4.3
1449
+ */
1450
+ function cptui_do_convert_taxonomy_terms() {
1451
+
1452
+ /**
1453
+ * Whether or not to convert taxonomy terms.
1454
+ *
1455
+ * @since 1.4.3
1456
+ *
1457
+ * @param bool $value Whether or not to convert.
1458
+ */
1459
+ if ( apply_filters( 'cptui_convert_taxonomy_terms', false ) ) {
1460
+ cptui_convert_taxonomy_terms( sanitize_text_field( $_POST['tax_original'] ), sanitize_text_field( $_POST['cpt_custom_tax']['name'] ) );
1461
+ }
1462
+ }
1463
+ add_action( 'init', 'cptui_do_convert_taxonomy_terms' );
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: webdevstudios, pluginize, tw2113, vegasgeek, modemlooper, williams
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3084056
4
  Tags: custom post types, CPT, CMS, post, types, post type, cck, taxonomy, tax, custom, content types, post types
5
  Requires at least: 4.2
6
- Tested up to: 4.6.1
7
- Stable tag: 1.4.2
8
  License: GPLv2
9
 
10
  Admin UI for creating custom post types and custom taxonomies in WordPress
@@ -30,6 +30,11 @@ All official development on this plugin is on GitHub. New releases are still pub
30
 
31
  == Changelog ==
32
 
 
 
 
 
 
33
  = 1.4.2 - 2016-10-03 =
34
  * Fixed: Responsiveness of sections and "ad" space when creating post types or taxonomies on smaller screens. Props @thecxguy
35
 
@@ -148,6 +153,11 @@ All official development on this plugin is on GitHub. New releases are still pub
148
 
149
  == Upgrade Notice ==
150
 
 
 
 
 
 
151
  = 1.4.2 - 2016-10-03 =
152
  * Fixed: Responsiveness of sections and "ad" space when creating post types or taxonomies on smaller screens. Props @thecxguy
153
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3084056
4
  Tags: custom post types, CPT, CMS, post, types, post type, cck, taxonomy, tax, custom, content types, post types
5
  Requires at least: 4.2
6
+ Tested up to: 4.7
7
+ Stable tag: 1.4.3
8
  License: GPLv2
9
 
10
  Admin UI for creating custom post types and custom taxonomies in WordPress
30
 
31
  == Changelog ==
32
 
33
+ = 1.4.3 - 2016-10-17 =
34
+ * Fixed: issue with post types and taxonomies trying to be converted before registration. Prevented full success of process.
35
+ * Fixed: Prevent trying to convert taxonomy terms if no terms exist. Taxonomy will still be deleted from CPTUI list.
36
+ * Fixed: Prevent trying to redirect on activation if being network-activated.
37
+
38
  = 1.4.2 - 2016-10-03 =
39
  * Fixed: Responsiveness of sections and "ad" space when creating post types or taxonomies on smaller screens. Props @thecxguy
40
 
153
 
154
  == Upgrade Notice ==
155
 
156
+ = 1.4.3 - TBD =
157
+ * Fixed: issue with post types and taxonomies trying to be converted before registration. Prevented full success of process.
158
+ * Fixed: Prevent trying to convert taxonomy terms if no terms exist. Taxonomy will still be deleted from CPTUI list.
159
+ * Fixed: Prevent trying to redirect on activation if being network-activated.
160
+
161
  = 1.4.2 - 2016-10-03 =
162
  * Fixed: Responsiveness of sections and "ad" space when creating post types or taxonomies on smaller screens. Props @thecxguy
163