Custom Post Types and Custom Fields creator – WCK - Version 2.3.2

Version Description

  • Fix: menu position issue with WordPress 6.0
  • Fix: some issues with PHP 8.1
Download this release

Release Info

Developer madalin.ungureanu
Plugin Icon 128x128 Custom Post Types and Custom Fields creator – WCK
Version 2.3.2
Comparing to
See all releases

Code changes from version 2.3.1 to 2.3.2

readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: cozmoslabs, reflectionmedia, madalin.ungureanu, sareiodata, adispi
3
  Donate link: http://www.cozmoslabs.com/wordpress-creation-kit/
4
  Tags: custom fields, custom field, wordpress custom fields, custom post type, custom post types, post types, repeater fields, meta box, metabox, custom taxonomy, custom fields creator, post meta
5
  Requires at least: 3.1
6
- Tested up to: 5.9.3
7
- Stable tag: 2.3.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -135,6 +135,10 @@ Creating a taxonomy generally automatically creates a special query variable usi
135
  10. Taxonomy listing
136
 
137
  == Changelog ==
 
 
 
 
138
  = 2.3.1 =
139
  * Compatibility fixes for PHP 8.0
140
 
3
  Donate link: http://www.cozmoslabs.com/wordpress-creation-kit/
4
  Tags: custom fields, custom field, wordpress custom fields, custom post type, custom post types, post types, repeater fields, meta box, metabox, custom taxonomy, custom fields creator, post meta
5
  Requires at least: 3.1
6
+ Tested up to: 6.0.0
7
+ Stable tag: 2.3.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
135
  10. Taxonomy listing
136
 
137
  == Changelog ==
138
+ = 2.3.2 =
139
+ * Fix: menu position issue with WordPress 6.0
140
+ * Fix: some issues with PHP 8.1
141
+
142
  = 2.3.1 =
143
  * Compatibility fixes for PHP 8.0
144
 
wck-cfc.php CHANGED
@@ -1277,7 +1277,9 @@ function wck_serialized_update_from_unserialized( $replace, $object_id, $meta_ke
1277
  $unserialized_key = Wordpress_Creation_Kit::wck_generate_unique_meta_name_for_unserialized_field( $object_id, $slug, $cfc_args[0]['meta-name'] );
1278
 
1279
  /* I will limit this to maximum 100 repeater field entries */
1280
- for( $i=0; $i<1000;$i++ ){
 
 
1281
  /* search for the unseralized form in the db */
1282
  if( $i == 0 )
1283
  $suffix = '';
1277
  $unserialized_key = Wordpress_Creation_Kit::wck_generate_unique_meta_name_for_unserialized_field( $object_id, $slug, $cfc_args[0]['meta-name'] );
1278
 
1279
  /* I will limit this to maximum 100 repeater field entries */
1280
+ $maximum_repeater_count = apply_filters( 'wck_cfc_maximum_repeater_count', 2000 );
1281
+
1282
+ for( $i=0; $i < $maximum_repeater_count; $i++ ){
1283
  /* search for the unseralized form in the db */
1284
  if( $i == 0 )
1285
  $suffix = '';
wck.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WCK - Custom Fields and Custom Post Types Creator
4
  Description: WordPress Creation Kit consists of three tools that can help you create and maintain custom post types, custom taxonomies and most importantly, custom fields and metaboxes for your posts, pages or CPT's.
5
  Author: Cozmoslabs, Madalin Ungureanu, Cristian Antohe
6
- Version: 2.3.1
7
  Author URI: http://www.cozmoslabs.com
8
  Text Domain: wck
9
  Domain Path: /languages
@@ -53,7 +53,7 @@ $args = array(
53
  'capability' => 'edit_theme_options',
54
  'menu_slug' => 'wck-page',
55
  'page_type' => 'menu_page',
56
- 'position' => '30,27',
57
  'priority' => 7,
58
  'icon_url' => plugins_url('/images/wck-menu-item.png', __FILE__)
59
  );
3
  Plugin Name: WCK - Custom Fields and Custom Post Types Creator
4
  Description: WordPress Creation Kit consists of three tools that can help you create and maintain custom post types, custom taxonomies and most importantly, custom fields and metaboxes for your posts, pages or CPT's.
5
  Author: Cozmoslabs, Madalin Ungureanu, Cristian Antohe
6
+ Version: 2.3.2
7
  Author URI: http://www.cozmoslabs.com
8
  Text Domain: wck
9
  Domain Path: /languages
53
  'capability' => 'edit_theme_options',
54
  'menu_slug' => 'wck-page',
55
  'page_type' => 'menu_page',
56
+ 'position' => '30.27',
57
  'priority' => 7,
58
  'icon_url' => plugins_url('/images/wck-menu-item.png', __FILE__)
59
  );
wordpress-creation-kit-api/assets/map/map.php CHANGED
@@ -37,7 +37,15 @@ function wck_map_field_add_meta( $meta, $id, $values, $element_id = '' ) {
37
  continue;
38
 
39
  // calculate element id
40
- $element_id = ( $element_id != '' ? ( (int)$element_id + 1 ) : ( $args[0]['repeater'] == 'false' ? 1 : count( (array)$meta_values ) + 1 ) );
 
 
 
 
 
 
 
 
41
 
42
  $fields = get_post_meta( $field_set->ID, 'wck_' . ( !empty( $id ) ? 'cfc' : 'opc' ) . '_fields', true );
43
 
37
  continue;
38
 
39
  // calculate element id
40
+ if ( function_exists( 'is_countable' ) && is_countable($meta_values) && count($meta_values) > 0) {
41
+ $meta_values_count = count($meta_values);
42
+ } else if( is_array( $meta_values ) && count($meta_values) > 0 ){
43
+ $meta_values_count = count($meta_values);
44
+ } else {
45
+ $meta_values_count = 1;
46
+ }
47
+
48
+ $element_id = ( $element_id != '' ? ( (int)$element_id + 1 ) : ( $args[0]['repeater'] == 'false' ? 1 : $meta_values_count + 1 ) );
49
 
50
  $fields = get_post_meta( $field_set->ID, 'wck_' . ( !empty( $id ) ? 'cfc' : 'opc' ) . '_fields', true );
51
 
wordpress-creation-kit-api/wordpress-creation-kit.php CHANGED
@@ -1409,12 +1409,19 @@ class Wordpress_Creation_Kit{
1409
  foreach ($this->args['meta_array'] as $meta_field) {
1410
  /* check to see if we already have a meta name like this from the old structure to avoid conflicts */
1411
  $name = Wordpress_Creation_Kit::wck_generate_unique_meta_name_for_unserialized_field( $post_id, Wordpress_Creation_Kit::wck_generate_slug( $meta_field['title'], $meta_field ), $meta_name );
1412
- $meta_val = $_POST[$this->args['meta_name'] . '_' . Wordpress_Creation_Kit::wck_generate_slug( $meta_field['title'], $meta_field )];
1413
- if( is_array($meta_val) )
1414
- $meta_val = array_map( array($this, 'wck_sanitize_value'), $meta_val );
1415
- else
1416
- $meta_val = $this->wck_sanitize_value( $meta_val );
1417
- update_post_meta($post_id, $name, $meta_val );
 
 
 
 
 
 
 
1418
  }
1419
  }
1420
  }
1409
  foreach ($this->args['meta_array'] as $meta_field) {
1410
  /* check to see if we already have a meta name like this from the old structure to avoid conflicts */
1411
  $name = Wordpress_Creation_Kit::wck_generate_unique_meta_name_for_unserialized_field( $post_id, Wordpress_Creation_Kit::wck_generate_slug( $meta_field['title'], $meta_field ), $meta_name );
1412
+
1413
+ if( isset( $_POST[$this->args['meta_name'] . '_' . Wordpress_Creation_Kit::wck_generate_slug( $meta_field['title'], $meta_field )] ) ) {
1414
+
1415
+ $meta_val = $_POST[$this->args['meta_name'] . '_' . Wordpress_Creation_Kit::wck_generate_slug( $meta_field['title'], $meta_field )];
1416
+
1417
+ if( is_array($meta_val) )
1418
+ $meta_val = array_map( array($this, 'wck_sanitize_value'), $meta_val );
1419
+ else
1420
+ $meta_val = $this->wck_sanitize_value( $meta_val );
1421
+ update_post_meta($post_id, $name, $meta_val );
1422
+
1423
+ }
1424
+
1425
  }
1426
  }
1427
  }