Custom Post Type UI - Version 1.11.0

Version Description

  • 2022-03-17 =
  • Added: "sort" argument for taxonomies.
  • Added: "can export" argument for post types
  • Added: New taxonomy labels from WordPress 5.9
  • Added: Custom option to set "Enter title here" value for post types.
  • Added: Notes around "exclude from search" argument for post types and taxonomy term archives.
  • Added: Notes around taxonomy "hierarchical" option regarding category vs tag behavior.
  • Updated: Reserved post type slugs from recent WordPress releases.
  • Fixed: PHP warnings around foreach loops in cptui_published_post_format_fix()
Download this release

Release Info

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

Code changes from version 1.10.2 to 1.11.0

custom-post-type-ui.php CHANGED
@@ -16,7 +16,7 @@
16
  * Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
17
  * Description: Admin panel for creating custom post types and custom taxonomies in WordPress
18
  * Author: WebDevStudios
19
- * Version: 1.10.2
20
  * Author URI: https://webdevstudios.com/
21
  * Text Domain: custom-post-type-ui
22
  * Domain Path: /languages
@@ -30,8 +30,8 @@ if ( ! defined( 'ABSPATH' ) ) {
30
  exit;
31
  }
32
 
33
- define( 'CPT_VERSION', '1.10.2' ); // Left for legacy purposes.
34
- define( 'CPTUI_VERSION', '1.10.2' );
35
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
36
 
37
  /**
@@ -492,6 +492,11 @@ function cptui_register_single_post_type( $post_type = [] ) {
492
  $rest_controller_class = $post_type['rest_controller_class'];
493
  }
494
 
 
 
 
 
 
495
  $args = [
496
  'labels' => $labels,
497
  'description' => $post_type['description'],
@@ -509,6 +514,7 @@ function cptui_register_single_post_type( $post_type = [] ) {
509
  'capability_type' => $capability_type,
510
  'map_meta_cap' => $post_type['map_meta_cap'],
511
  'hierarchical' => get_disp_boolean( $post_type['hierarchical'] ),
 
512
  'rewrite' => $rewrite,
513
  'menu_position' => $menu_position,
514
  'menu_icon' => $menu_icon,
@@ -699,6 +705,8 @@ function cptui_register_single_taxonomy( $taxonomy = [] ) {
699
 
700
  $show_in_quick_edit = ( ! empty( $taxonomy['show_in_quick_edit'] ) && false !== get_disp_boolean( $taxonomy['show_in_quick_edit'] ) ) ? true : false;
701
 
 
 
702
  $rest_base = null;
703
  if ( ! empty( $taxonomy['rest_base'] ) ) {
704
  $rest_base = $taxonomy['rest_base'];
@@ -745,6 +753,7 @@ function cptui_register_single_taxonomy( $taxonomy = [] ) {
745
  'rest_base' => $rest_base,
746
  'rest_controller_class' => $rest_controller_class,
747
  'show_in_quick_edit' => $show_in_quick_edit,
 
748
  'meta_box_cb' => $meta_box_cb,
749
  'default_term' => $default_term,
750
  ];
16
  * Plugin URI: https://github.com/WebDevStudios/custom-post-type-ui/
17
  * Description: Admin panel for creating custom post types and custom taxonomies in WordPress
18
  * Author: WebDevStudios
19
+ * Version: 1.11.0
20
  * Author URI: https://webdevstudios.com/
21
  * Text Domain: custom-post-type-ui
22
  * Domain Path: /languages
30
  exit;
31
  }
32
 
33
+ define( 'CPT_VERSION', '1.11.0' ); // Left for legacy purposes.
34
+ define( 'CPTUI_VERSION', '1.11.0' );
35
  define( 'CPTUI_WP_VERSION', get_bloginfo( 'version' ) );
36
 
37
  /**
492
  $rest_controller_class = $post_type['rest_controller_class'];
493
  }
494
 
495
+ $can_export = null;
496
+ if ( ! empty( $post_type['can_export'] ) ) {
497
+ $delete_with_user = get_disp_boolean( $post_type['can_export'] );
498
+ }
499
+
500
  $args = [
501
  'labels' => $labels,
502
  'description' => $post_type['description'],
514
  'capability_type' => $capability_type,
515
  'map_meta_cap' => $post_type['map_meta_cap'],
516
  'hierarchical' => get_disp_boolean( $post_type['hierarchical'] ),
517
+ 'can_export' => $can_export,
518
  'rewrite' => $rewrite,
519
  'menu_position' => $menu_position,
520
  'menu_icon' => $menu_icon,
705
 
706
  $show_in_quick_edit = ( ! empty( $taxonomy['show_in_quick_edit'] ) && false !== get_disp_boolean( $taxonomy['show_in_quick_edit'] ) ) ? true : false;
707
 
708
+ $sort = ( ! empty( $taxonomy['sort'] ) && false !== get_disp_boolean( $taxonomy['sort'] ) ) ? true : false;
709
+
710
  $rest_base = null;
711
  if ( ! empty( $taxonomy['rest_base'] ) ) {
712
  $rest_base = $taxonomy['rest_base'];
753
  'rest_base' => $rest_base,
754
  'rest_controller_class' => $rest_controller_class,
755
  'show_in_quick_edit' => $show_in_quick_edit,
756
+ 'sort' => $sort,
757
  'meta_box_cb' => $meta_box_cb,
758
  'default_term' => $default_term,
759
  ];
inc/post-types.php CHANGED
@@ -790,6 +790,20 @@ function cptui_manage_post_types() {
790
  ],
791
  ] );
792
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
793
  ?>
794
  </table>
795
  </div>
@@ -968,7 +982,7 @@ function cptui_manage_post_types() {
968
  'namearray' => 'cpt_custom_post_type',
969
  'name' => 'exclude_from_search',
970
  'labeltext' => esc_html__( 'Exclude From Search', 'custom-post-type-ui' ),
971
- 'aftertext' => esc_html__( '(default: false) Whether or not to exclude posts with this post type from front end search results.', 'custom-post-type-ui' ),
972
  'selections' => $select,
973
  ] );
974
 
@@ -996,6 +1010,22 @@ function cptui_manage_post_types() {
996
  'selections' => $select,
997
  ] );
998
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
999
  $select = [
1000
  'options' => [
1001
  [ 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ],
@@ -1721,6 +1751,7 @@ function cptui_update_post_type( $data = [] ) {
1721
  $show_in_menu_string = trim( $data['cpt_custom_post_type']['show_in_menu_string'] );
1722
  $menu_icon = trim( $data['cpt_custom_post_type']['menu_icon'] );
1723
  $custom_supports = trim( $data['cpt_custom_post_type']['custom_supports'] );
 
1724
 
1725
  $post_types[ $data['cpt_custom_post_type']['name'] ] = [
1726
  'name' => $name,
@@ -1740,6 +1771,7 @@ function cptui_update_post_type( $data = [] ) {
1740
  'exclude_from_search' => disp_boolean( $data['cpt_custom_post_type']['exclude_from_search'] ),
1741
  'capability_type' => $capability_type,
1742
  'hierarchical' => disp_boolean( $data['cpt_custom_post_type']['hierarchical'] ),
 
1743
  'rewrite' => disp_boolean( $data['cpt_custom_post_type']['rewrite'] ),
1744
  'rewrite_slug' => $rewrite_slug,
1745
  'rewrite_withfront' => disp_boolean( $data['cpt_custom_post_type']['rewrite_withfront'] ),
@@ -1753,6 +1785,7 @@ function cptui_update_post_type( $data = [] ) {
1753
  'taxonomies' => $data['cpt_addon_taxes'],
1754
  'labels' => $data['cpt_labels'],
1755
  'custom_supports' => $custom_supports,
 
1756
  ];
1757
 
1758
  /**
@@ -1820,6 +1853,13 @@ function cptui_reserved_post_types() {
1820
  'customize_changeset',
1821
  'author',
1822
  'post_type',
 
 
 
 
 
 
 
1823
  ];
1824
 
1825
  /**
@@ -2090,3 +2130,17 @@ function cptui_filtered_post_type_post_global() {
2090
 
2091
  return $filtered_data;
2092
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
790
  ],
791
  ] );
792
 
793
+ echo $ui->get_text_input( [
794
+ 'labeltext' => esc_html__( 'Add Title', 'custom-post-type-ui' ),
795
+ 'helptext' => esc_html__( 'Placeholder text in the "title" input when creating a post. Not exportable.', 'custom-post-type-ui' ),
796
+ 'namearray' => 'cpt_custom_post_type',
797
+ 'name' => 'enter_title_here',
798
+ 'textvalue' => isset( $current['enter_title_here'] ) ? esc_attr( $current['enter_title_here'] ) : '',
799
+ 'aftertext' => esc_html__( '(e.g. Add Movie)', 'custom-post-type-ui' ),
800
+ 'data' => [
801
+ /* translators: Used for autofill */
802
+ 'label' => sprintf( esc_attr__( 'Add %s', 'custom-post-type-ui' ), 'item' ),
803
+ 'plurality' => 'singular',
804
+ ],
805
+ ] );
806
+
807
  ?>
808
  </table>
809
  </div>
982
  'namearray' => 'cpt_custom_post_type',
983
  'name' => 'exclude_from_search',
984
  'labeltext' => esc_html__( 'Exclude From Search', 'custom-post-type-ui' ),
985
+ 'aftertext' => esc_html__( '(default: false) Whether or not to exclude posts with this post type from front end search results. This also excludes from taxonomy term archives.', 'custom-post-type-ui' ),
986
  'selections' => $select,
987
  ] );
988
 
1010
  'selections' => $select,
1011
  ] );
1012
 
1013
+ $select = [
1014
+ 'options' => [
1015
+ [ 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ), 'default' => 'false' ],
1016
+ [ 'attr' => '1', 'text' => esc_attr__( 'True', 'custom-post-type-ui' ) ],
1017
+ ],
1018
+ ];
1019
+ $selected = isset( $current ) ? disp_boolean( $current['can_export'] ) : '';
1020
+ $select['selected'] = ! empty( $selected ) ? $current['can_export'] : '';
1021
+ echo $ui->get_select_input( [
1022
+ 'namearray' => 'cpt_custom_post_type',
1023
+ 'name' => 'can_export',
1024
+ 'labeltext' => esc_html__( 'Can Export', 'custom-post-type-ui' ),
1025
+ 'aftertext' => esc_html__( '(default: false) Can this post_type be exported.', 'custom-post-type-ui' ),
1026
+ 'selections' => $select,
1027
+ ] );
1028
+
1029
  $select = [
1030
  'options' => [
1031
  [ 'attr' => '0', 'text' => esc_attr__( 'False', 'custom-post-type-ui' ) ],
1751
  $show_in_menu_string = trim( $data['cpt_custom_post_type']['show_in_menu_string'] );
1752
  $menu_icon = trim( $data['cpt_custom_post_type']['menu_icon'] );
1753
  $custom_supports = trim( $data['cpt_custom_post_type']['custom_supports'] );
1754
+ $enter_title_here = trim( $data['cpt_custom_post_type']['enter_title_here'] );
1755
 
1756
  $post_types[ $data['cpt_custom_post_type']['name'] ] = [
1757
  'name' => $name,
1771
  'exclude_from_search' => disp_boolean( $data['cpt_custom_post_type']['exclude_from_search'] ),
1772
  'capability_type' => $capability_type,
1773
  'hierarchical' => disp_boolean( $data['cpt_custom_post_type']['hierarchical'] ),
1774
+ 'can_export' => disp_boolean( $data['cpt_custom_post_type']['can_export'] ),
1775
  'rewrite' => disp_boolean( $data['cpt_custom_post_type']['rewrite'] ),
1776
  'rewrite_slug' => $rewrite_slug,
1777
  'rewrite_withfront' => disp_boolean( $data['cpt_custom_post_type']['rewrite_withfront'] ),
1785
  'taxonomies' => $data['cpt_addon_taxes'],
1786
  'labels' => $data['cpt_labels'],
1787
  'custom_supports' => $custom_supports,
1788
+ 'enter_title_here' => $enter_title_here,
1789
  ];
1790
 
1791
  /**
1853
  'customize_changeset',
1854
  'author',
1855
  'post_type',
1856
+ 'oembed_cache',
1857
+ 'user_request',
1858
+ 'wp_block',
1859
+ 'wp_template',
1860
+ 'wp_template_part',
1861
+ 'wp_global_styles',
1862
+ 'wp_navigation',
1863
  ];
1864
 
1865
  /**
2130
 
2131
  return $filtered_data;
2132
  }
2133
+
2134
+ function cptui_custom_enter_title_here( $text, $post ) {
2135
+ $cptui_obj = cptui_get_cptui_post_type_object( $post->post_type );
2136
+ if ( empty( $cptui_obj ) ) {
2137
+ return $text;
2138
+ }
2139
+
2140
+ if ( empty( $cptui_obj['enter_title_here'] ) ) {
2141
+ return $text;
2142
+ }
2143
+
2144
+ return $cptui_obj['enter_title_here'];
2145
+ }
2146
+ add_filter( 'enter_title_here', 'cptui_custom_enter_title_here', 10, 2 );
inc/support.php CHANGED
@@ -213,14 +213,21 @@ function cptui_support() {
213
  ); ?>
214
  </div>
215
  </li>
 
 
 
 
 
 
 
216
  </ol>
217
  </td>
218
  <td class="outer">
219
  <h2><?php esc_html_e( 'Advanced', 'custom-post-type-ui' ); ?></h2>
220
  <ol id="questions_advanced">
221
  <li>
222
- <span tabindex="0" class="question" aria-controls="q19" aria-expanded="false"><?php esc_html_e( 'How do I add custom metaboxes to my post type?', 'custom-post-type-ui' ); ?></span>
223
- <div class="answer" id="q19">
224
  <?php
225
  printf(
226
  esc_html__( 'We recommend checking out %s, the latest iteration of "CMB2". Both are supported by WebDevStudios.', 'custom-post-type-ui' ),
@@ -229,8 +236,8 @@ function cptui_support() {
229
  </div>
230
  </li>
231
  <li>
232
- <span tabindex="0" class="question" aria-controls="q20" aria-expanded="false"><?php esc_html_e( 'How do I add a newly registered taxonomy to a post type that already exists?', 'custom-post-type-ui' ); ?></span>
233
- <div class="answer" id="q20">
234
  <?php
235
  printf(
236
  esc_html__( 'Check out the %s function for documentation and usage examples.', 'custom-post-type-ui' ),
@@ -239,8 +246,8 @@ function cptui_support() {
239
  </div>
240
  </li>
241
  <li>
242
- <span tabindex="0" class="question" aria-controls="q21" aria-expanded="false"><?php esc_html_e( 'Post relationships?', 'custom-post-type-ui' ); ?></span>
243
- <div class="answer" id="q21">
244
  <?php
245
  printf(
246
  esc_html__( '%s has an excellent %spost%s introducing users to the %sPosts 2 Posts%s plugin that should be a good start.', 'custom-post-type-ui' ),
@@ -252,13 +259,13 @@ function cptui_support() {
252
  ); ?></div>
253
  </li>
254
  <li>
255
- <span tabindex="0" class="question" aria-controls="q22" aria-expanded="false"><?php esc_html_e( 'Is there any function reference list?', 'custom-post-type-ui' ); ?></span>
256
- <div class="answer" id="q22"><?php printf( esc_html__( '%s has compiled a nice list of functions used by our plugin. Note not all will be useful as they are attached to hooks.', 'custom-post-type-ui' ),
257
  '<a href="http://hookr.io/plugins/custom-post-type-ui/" target="_blank" rel="noopener">Hookr.io</a>' ); ?></div>
258
  </li>
259
  <li>
260
- <span tabindex="0" class="question" aria-controls="q23" aria-expanded="false"><?php esc_html_e( 'How do I filter the "enter title here" text in the post editor screen?', 'custom-post-type-ui' ); ?></span>
261
- <div class="answer" id="q23"><p><?php esc_html_e( 'Change text inside the post/page editor title field. Should be able to adapt as necessary.', 'custom-post-type-ui' ); ?></p>
262
  <pre><code>function my_custom_title_text( $title ){
263
  global $post;
264
  if ( 'ENTER POST TYPE SLUG HERE' == $post->post_type )
@@ -269,8 +276,8 @@ add_filter( 'enter_title_here', 'my_custom_title_text' );
269
  </code></pre></div>
270
  </li>
271
  <li>
272
- <span tabindex="0" class="question" aria-controls="q24" aria-expanded="false"><?php esc_html_e( 'Any help with customizing capabilities?', 'custom-post-type-ui' ); ?></span>
273
- <div class="answer" id="q24">
274
  <p><?php printf( esc_html__( 'We recommend %s for some extended customization and addition of extra fields regarding roles and capabilities.', 'custom-post-type-ui' ),
275
  '<a href="https://github.com/tw2113/custom-post-type-ui-capabilities" target="_blank" rel="noopener">Custom Post Type UI Capabilities on GitHub</a>' ); ?></p>
276
  </div>
213
  ); ?>
214
  </div>
215
  </li>
216
+ <li>
217
+ <span tabindex="0" class="question" aria-controls="q19" aria-expanded="false"><?php esc_html_e( 'Why are my post types not showing in taxonomy term archives?', 'custom-post-type-ui' ); ?></span>
218
+ <div class="answer" id="q19">
219
+ <?php esc_html_e( 'If you have set "exclude from search" to True for the pot type, this would be why. If you need the post types in the archives, but still want to exclude them from search, it is recommended to use the "pre_get_posts" hook to unset the post type from considered types.', 'custom-post-type-ui' );
220
+ ?>
221
+ </div>
222
+ </li>
223
  </ol>
224
  </td>
225
  <td class="outer">
226
  <h2><?php esc_html_e( 'Advanced', 'custom-post-type-ui' ); ?></h2>
227
  <ol id="questions_advanced">
228
  <li>
229
+ <span tabindex="0" class="question" aria-controls="q20" aria-expanded="false"><?php esc_html_e( 'How do I add custom metaboxes to my post type?', 'custom-post-type-ui' ); ?></span>
230
+ <div class="answer" id="q20">
231
  <?php
232
  printf(
233
  esc_html__( 'We recommend checking out %s, the latest iteration of "CMB2". Both are supported by WebDevStudios.', 'custom-post-type-ui' ),
236
  </div>
237
  </li>
238
  <li>
239
+ <span tabindex="0" class="question" aria-controls="q21" aria-expanded="false"><?php esc_html_e( 'How do I add a newly registered taxonomy to a post type that already exists?', 'custom-post-type-ui' ); ?></span>
240
+ <div class="answer" id="q21">
241
  <?php
242
  printf(
243
  esc_html__( 'Check out the %s function for documentation and usage examples.', 'custom-post-type-ui' ),
246
  </div>
247
  </li>
248
  <li>
249
+ <span tabindex="0" class="question" aria-controls="q22" aria-expanded="false"><?php esc_html_e( 'Post relationships?', 'custom-post-type-ui' ); ?></span>
250
+ <div class="answer" id="q22">
251
  <?php
252
  printf(
253
  esc_html__( '%s has an excellent %spost%s introducing users to the %sPosts 2 Posts%s plugin that should be a good start.', 'custom-post-type-ui' ),
259
  ); ?></div>
260
  </li>
261
  <li>
262
+ <span tabindex="0" class="question" aria-controls="q23" aria-expanded="false"><?php esc_html_e( 'Is there any function reference list?', 'custom-post-type-ui' ); ?></span>
263
+ <div class="answer" id="q23"><?php printf( esc_html__( '%s has compiled a nice list of functions used by our plugin. Note not all will be useful as they are attached to hooks.', 'custom-post-type-ui' ),
264
  '<a href="http://hookr.io/plugins/custom-post-type-ui/" target="_blank" rel="noopener">Hookr.io</a>' ); ?></div>
265
  </li>
266
  <li>
267
+ <span tabindex="0" class="question" aria-controls="q24" aria-expanded="false"><?php esc_html_e( 'How do I filter the "enter title here" text in the post editor screen?', 'custom-post-type-ui' ); ?></span>
268
+ <div class="answer" id="q24"><p><?php esc_html_e( 'Change text inside the post/page editor title field. Should be able to adapt as necessary.', 'custom-post-type-ui' ); ?></p>
269
  <pre><code>function my_custom_title_text( $title ){
270
  global $post;
271
  if ( 'ENTER POST TYPE SLUG HERE' == $post->post_type )
276
  </code></pre></div>
277
  </li>
278
  <li>
279
+ <span tabindex="0" class="question" aria-controls="q25" aria-expanded="false"><?php esc_html_e( 'Any help with customizing capabilities?', 'custom-post-type-ui' ); ?></span>
280
+ <div class="answer" id="q25">
281
  <p><?php printf( esc_html__( 'We recommend %s for some extended customization and addition of extra fields regarding roles and capabilities.', 'custom-post-type-ui' ),
282
  '<a href="https://github.com/tw2113/custom-post-type-ui-capabilities" target="_blank" rel="noopener">Custom Post Type UI Capabilities on GitHub</a>' ); ?></p>
283
  </div>
inc/taxonomies.php CHANGED
@@ -708,6 +708,62 @@ function cptui_manage_taxonomies() {
708
  'plurality' => 'plural',
709
  ],
710
  ] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
711
  ?>
712
  </table>
713
  </div>
@@ -795,7 +851,7 @@ function cptui_manage_taxonomies() {
795
  'namearray' => 'cpt_custom_tax',
796
  'name' => 'hierarchical',
797
  'labeltext' => esc_html__( 'Hierarchical', 'custom-post-type-ui' ),
798
- 'aftertext' => esc_html__( '(default: false) Whether the taxonomy can have parent-child relationships.', 'custom-post-type-ui' ),
799
  'selections' => $select,
800
  ] );
801
 
@@ -1086,6 +1142,29 @@ function cptui_manage_taxonomies() {
1086
  'selections' => $select,
1087
  ] );
1088
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1089
  echo $ui->get_text_input( [
1090
  'namearray' => 'cpt_custom_tax',
1091
  'name' => 'meta_box_cb',
@@ -1474,6 +1553,7 @@ function cptui_update_taxonomy( $data = [] ) {
1474
  'show_admin_column' => disp_boolean( $data['cpt_custom_tax']['show_admin_column'] ),
1475
  'show_in_rest' => disp_boolean( $data['cpt_custom_tax']['show_in_rest'] ),
1476
  'show_tagcloud' => disp_boolean( $data['cpt_custom_tax']['show_tagcloud'] ),
 
1477
  'show_in_quick_edit' => $show_quickpanel_bulk,
1478
  'rest_base' => $rest_base,
1479
  'rest_controller_class' => $rest_controller_class,
708
  'plurality' => 'plural',
709
  ],
710
  ] );
711
+
712
+ echo $ui->get_text_input( [
713
+ 'namearray' => 'cpt_tax_labels',
714
+ 'name' => 'name_field_description',
715
+ 'textvalue' => isset( $current['labels']['name_field_description'] ) ? esc_attr( $current['labels']['name_field_description'] ) : null,
716
+ 'aftertext' => esc_html__( '(e.g. "The name is how it appears on your site."', 'custom-post-type-ui' ),
717
+ 'labeltext' => esc_html__( 'Term Name Field Description', 'custom-post-type-ui' ),
718
+ 'helptext' => esc_attr__( 'Description for the Name field on Edit Tags screen.', 'custom-post-type-ui' ),
719
+ 'data' => [
720
+ /* translators: Used for autofill */
721
+ 'label' => sprintf( esc_attr__( 'The name is how it appears on your site.', 'custom-post-type-ui' ), 'item' ),
722
+ 'plurality' => 'singular',
723
+ ],
724
+ ] );
725
+
726
+ echo $ui->get_text_input( [
727
+ 'namearray' => 'cpt_tax_labels',
728
+ 'name' => 'parent_field_description',
729
+ 'textvalue' => isset( $current['labels']['parent_field_description'] ) ? esc_attr( $current['labels']['parent_field_description'] ) : null,
730
+ 'aftertext' => esc_html__( '(e.g. "Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band."', 'custom-post-type-ui' ),
731
+ 'labeltext' => esc_html__( 'Term Parent Field Description', 'custom-post-type-ui' ),
732
+ 'helptext' => esc_attr__( 'Description for the Parent field on Edit Tags screen.', 'custom-post-type-ui' ),
733
+ 'data' => [
734
+ /* translators: Used for autofill */
735
+ 'label' => sprintf( esc_attr__( 'Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.', 'custom-post-type-ui' ), 'item' ),
736
+ 'plurality' => 'singular',
737
+ ],
738
+ ] );
739
+
740
+ echo $ui->get_text_input( [
741
+ 'namearray' => 'cpt_tax_labels',
742
+ 'name' => 'slug_field_description',
743
+ 'textvalue' => isset( $current['labels']['slug_field_description'] ) ? esc_attr( $current['labels']['slug_field_description'] ) : null,
744
+ 'aftertext' => esc_html__( '(e.g. "The « slug » is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens."', 'custom-post-type-ui' ),
745
+ 'labeltext' => esc_html__( 'Term Slug Field Description', 'custom-post-type-ui' ),
746
+ 'helptext' => esc_attr__( 'Description for the Slug field on Edit Tags screen. ', 'custom-post-type-ui' ),
747
+ 'data' => [
748
+ /* translators: Used for autofill */
749
+ 'label' => sprintf( esc_attr__( 'The "slug" is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'custom-post-type-ui' ), 'item' ),
750
+ 'plurality' => 'singular',
751
+ ],
752
+ ] );
753
+
754
+ echo $ui->get_text_input( [
755
+ 'namearray' => 'cpt_tax_labels',
756
+ 'name' => 'desc_field_description',
757
+ 'textvalue' => isset( $current['labels']['desc_field_description'] ) ? esc_attr( $current['labels']['desc_field_description'] ) : null,
758
+ 'aftertext' => esc_html__( '(e.g. "The description is not prominent by default; however, some themes may show it."', 'custom-post-type-ui' ),
759
+ 'labeltext' => esc_html__( 'Term Description Field Description', 'custom-post-type-ui' ),
760
+ 'helptext' => esc_attr__( 'Description for the Description field on Edit Tags screen.', 'custom-post-type-ui' ),
761
+ 'data' => [
762
+ /* translators: Used for autofill */
763
+ 'label' => sprintf( esc_attr__( 'The description is not prominent by default; however, some themes may show it.', 'custom-post-type-ui' ), 'item' ),
764
+ 'plurality' => 'plural',
765
+ ],
766
+ ] );
767
  ?>
768
  </table>
769
  </div>
851
  'namearray' => 'cpt_custom_tax',
852
  'name' => 'hierarchical',
853
  'labeltext' => esc_html__( 'Hierarchical', 'custom-post-type-ui' ),
854
+ 'aftertext' => esc_html__( '(default: false) Whether the taxonomy can have parent-child relationships. "True" gives checkboxes, "False" gives text input.', 'custom-post-type-ui' ),
855
  'selections' => $select,
856
  ] );
857
 
1142
  'selections' => $select,
1143
  ] );
1144
 
1145
+ $select = [
1146
+ 'options' => [
1147
+ [
1148
+ 'attr' => '0',
1149
+ 'text' => esc_attr__( 'False', 'custom-post-type-ui' ),
1150
+ 'default' => 'false',
1151
+ ],
1152
+ [
1153
+ 'attr' => '1',
1154
+ 'text' => esc_attr__( 'True', 'custom-post-type-ui' ),
1155
+ ],
1156
+ ],
1157
+ ];
1158
+ $selected = isset( $current ) ? disp_boolean( $current['sort'] ) : '';
1159
+ $select['selected'] = ! empty( $selected ) ? $current['sort'] : '';
1160
+ echo $ui->get_select_input( [
1161
+ 'namearray' => 'cpt_custom_tax',
1162
+ 'name' => 'sort',
1163
+ 'labeltext' => esc_html__( 'Sort', 'custom-post-type-ui' ),
1164
+ 'aftertext' => esc_html__( 'Whether terms in this taxonomy should be sorted in the order they are provided to wp_set_object_terms()', 'custom-post-type-ui' ),
1165
+ 'selections' => $select,
1166
+ ] );
1167
+
1168
  echo $ui->get_text_input( [
1169
  'namearray' => 'cpt_custom_tax',
1170
  'name' => 'meta_box_cb',
1553
  'show_admin_column' => disp_boolean( $data['cpt_custom_tax']['show_admin_column'] ),
1554
  'show_in_rest' => disp_boolean( $data['cpt_custom_tax']['show_in_rest'] ),
1555
  'show_tagcloud' => disp_boolean( $data['cpt_custom_tax']['show_tagcloud'] ),
1556
+ 'sort' => disp_boolean( $data['cpt_custom_tax']['sort'] ),
1557
  'show_in_quick_edit' => $show_quickpanel_bulk,
1558
  'rest_base' => $rest_base,
1559
  'rest_controller_class' => $rest_controller_class,
inc/tools.php CHANGED
@@ -346,6 +346,7 @@ foreach ( $taxonomy['labels'] as $key => $label ) {
346
  "rest_base" => "<?php echo $rest_base; ?>",
347
  "rest_controller_class" => "<?php echo $rest_controller_class; ?>",
348
  "show_in_quick_edit" => <?php echo $show_in_quick_edit; ?>,
 
349
  <?php if ( $show_graphql ) : ?>
350
  "show_in_graphql" => <?php echo disp_boolean( $taxonomy['show_in_graphql'] ); ?>,
351
  "graphql_single_name" => "<?php echo esc_html( $taxonomy['graphql_single_name'] ); ?>",
@@ -576,6 +577,7 @@ function cptui_get_single_post_type_registery( $post_type = [] ) {
576
  "capability_type" => <?php echo $capability_type; ?>,
577
  "map_meta_cap" => <?php echo disp_boolean( $post_type['map_meta_cap'] ); ?>,
578
  "hierarchical" => <?php echo disp_boolean( $post_type['hierarchical'] ); ?>,
 
579
  "rewrite" => <?php echo $rewrite; ?>,
580
  "query_var" => <?php echo $post_type['query_var']; ?>,
581
  <?php if ( ! empty( $post_type['menu_position'] ) ) { ?>
346
  "rest_base" => "<?php echo $rest_base; ?>",
347
  "rest_controller_class" => "<?php echo $rest_controller_class; ?>",
348
  "show_in_quick_edit" => <?php echo $show_in_quick_edit; ?>,
349
+ "sort" => <?php echo disp_boolean( $taxonomy['sort'] ); ?>,
350
  <?php if ( $show_graphql ) : ?>
351
  "show_in_graphql" => <?php echo disp_boolean( $taxonomy['show_in_graphql'] ); ?>,
352
  "graphql_single_name" => "<?php echo esc_html( $taxonomy['graphql_single_name'] ); ?>",
577
  "capability_type" => <?php echo $capability_type; ?>,
578
  "map_meta_cap" => <?php echo disp_boolean( $post_type['map_meta_cap'] ); ?>,
579
  "hierarchical" => <?php echo disp_boolean( $post_type['hierarchical'] ); ?>,
580
+ "can_export" => <?php echo disp_boolean( $post_type['can_export'] ); ?>,
581
  "rewrite" => <?php echo $rewrite; ?>,
582
  "query_var" => <?php echo $post_type['query_var']; ?>,
583
  <?php if ( ! empty( $post_type['menu_position'] ) ) { ?>
inc/utility.php CHANGED
@@ -938,6 +938,10 @@ function cptui_published_post_format_fix( $post_types ) {
938
  }
939
 
940
  foreach ( $post_types as $type ) {
 
 
 
 
941
  if ( in_array( 'post-formats', $type['supports'], true ) ) {
942
  add_post_type_support( $type['name'], 'post-formats' );
943
  register_taxonomy_for_object_type( 'post_format', $type['name'] );
938
  }
939
 
940
  foreach ( $post_types as $type ) {
941
+ if ( ! is_array( $type['supports'] ) ) {
942
+ continue;
943
+ }
944
+
945
  if ( in_array( 'post-formats', $type['supports'], true ) ) {
946
  add_post_type_support( $type['name'], 'post-formats' );
947
  register_taxonomy_for_object_type( 'post_format', $type['name'] );
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: webdevstudios, pluginize, tw2113, vegasgeek, modemlooper, williamsba1
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, taxonomy, tax, custom, content types, post types
5
- Requires at least: 5.5
6
  Tested up to: 5.9.0
7
- Stable tag: 1.10.2
8
  License: GPL-2.0+
9
  Requires PHP: 5.6
10
 
@@ -31,6 +31,16 @@ Official development of Custom Post Type UI is on GitHub, with official stable r
31
 
32
  == Changelog ==
33
 
 
 
 
 
 
 
 
 
 
 
34
  = 1.10.2 - 2022-01-28 =
35
  * Updated: Confirmed compatibility with WordPress 5.9
36
 
@@ -64,6 +74,16 @@ Official development of Custom Post Type UI is on GitHub, with official stable r
64
 
65
  == Upgrade Notice ==
66
 
 
 
 
 
 
 
 
 
 
 
67
  = 1.10.2 - 2022-01-28 =
68
  * Updated: Confirmed compatibility with WordPress 5.9
69
 
2
  Contributors: webdevstudios, pluginize, tw2113, vegasgeek, modemlooper, williamsba1
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, taxonomy, tax, custom, content types, post types
5
+ Requires at least: 5.9
6
  Tested up to: 5.9.0
7
+ Stable tag: 1.11.0
8
  License: GPL-2.0+
9
  Requires PHP: 5.6
10
 
31
 
32
  == Changelog ==
33
 
34
+ = 1.11.0 - 2022-03-17 =
35
+ * Added: "sort" argument for taxonomies.
36
+ * Added: "can export" argument for post types
37
+ * Added: New taxonomy labels from WordPress 5.9
38
+ * Added: Custom option to set "Enter title here" value for post types.
39
+ * Added: Notes around "exclude from search" argument for post types and taxonomy term archives.
40
+ * Added: Notes around taxonomy "hierarchical" option regarding category vs tag behavior.
41
+ * Updated: Reserved post type slugs from recent WordPress releases.
42
+ * Fixed: PHP warnings around foreach loops in cptui_published_post_format_fix()
43
+
44
  = 1.10.2 - 2022-01-28 =
45
  * Updated: Confirmed compatibility with WordPress 5.9
46
 
74
 
75
  == Upgrade Notice ==
76
 
77
+ = 1.11.0 - 2022-03-17 =
78
+ * Added: "sort" argument for taxonomies.
79
+ * Added: "can export" argument for post types
80
+ * Added: New taxonomy labels from WordPress 5.9
81
+ * Added: Custom option to set "Enter title here" value for post types.
82
+ * Added: Notes around "exclude from search" argument for post types and taxonomy term archives.
83
+ * Added: Notes around taxonomy "hierarchical" option regarding category vs tag behavior.
84
+ * Updated: Reserved post type slugs from recent WordPress releases.
85
+ * Fixed: PHP warnings around foreach loops in cptui_published_post_format_fix()
86
+
87
  = 1.10.2 - 2022-01-28 =
88
  * Updated: Confirmed compatibility with WordPress 5.9
89