Advanced Custom Fields - Version 5.9.3

Version Description

Release Date - 3 November 2020

  • Fix - Fixed bug causing Revision meta to incorrectly update the parent Post meta.
  • Fix - Fixed bug breaking "Filter by Post Type" and "Filter by Taxonomy" Field settings.
Download this release

Release Info

Developer elliotcondon
Plugin Icon 128x128 Advanced Custom Fields
Version 5.9.3
Comparing to
See all releases

Code changes from version 5.9.2 to 5.9.3

acf.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Advanced Custom Fields
4
  Plugin URI: https://www.advancedcustomfields.com
5
  Description: Customize WordPress with powerful, professional and intuitive fields.
6
- Version: 5.9.2
7
  Author: Elliot Condon
8
  Author URI: https://www.advancedcustomfields.com
9
  Text Domain: acf
@@ -17,7 +17,7 @@ if( ! class_exists('ACF') ) :
17
  class ACF {
18
 
19
  /** @var string The plugin version number. */
20
- var $version = '5.9.2';
21
 
22
  /** @var array The plugin settings array. */
23
  var $settings = array();
3
  Plugin Name: Advanced Custom Fields
4
  Plugin URI: https://www.advancedcustomfields.com
5
  Description: Customize WordPress with powerful, professional and intuitive fields.
6
+ Version: 5.9.3
7
  Author: Elliot Condon
8
  Author URI: https://www.advancedcustomfields.com
9
  Text Domain: acf
17
  class ACF {
18
 
19
  /** @var string The plugin version number. */
20
+ var $version = '5.9.3';
21
 
22
  /** @var array The plugin settings array. */
23
  var $settings = array();
includes/acf-meta-functions.php CHANGED
@@ -15,18 +15,20 @@ function acf_get_meta( $post_id = 0 ) {
15
 
16
  // Allow filter to short-circuit load_value logic.
17
  $null = apply_filters( "acf/pre_load_meta", null, $post_id );
18
- if( $null !== null ) {
19
- return ( $null === '__return_null' ) ? null : $null;
20
- }
21
-
22
  // Decode $post_id for $type and $id.
23
  extract( acf_decode_post_id($post_id) );
24
 
25
  // Determine CRUD function.
26
- if( function_exists("get_{$type}_meta") ) {
27
- $allmeta = call_user_func("get_{$type}_meta", $id, '');
28
- } else {
29
  $allmeta = acf_get_option_meta( $id );
 
 
30
  }
31
 
32
  // Loop over meta and check that a reference exists for each value.
@@ -120,10 +122,10 @@ function acf_get_metadata( $post_id = 0, $name = '', $hidden = false ) {
120
 
121
  // Allow filter to short-circuit logic.
122
  $null = apply_filters( "acf/pre_load_metadata", null, $post_id, $name, $hidden );
123
- if( $null !== null ) {
124
- return ( $null === '__return_null' ) ? null : $null;
125
- }
126
-
127
  // Decode $post_id for $type and $id.
128
  extract( acf_decode_post_id($post_id) );
129
 
@@ -136,11 +138,13 @@ function acf_get_metadata( $post_id = 0, $name = '', $hidden = false ) {
136
  }
137
 
138
  // Determine CRUD function.
139
- if( function_exists("get_{$type}_meta") ) {
140
- $meta = call_user_func("get_{$type}_meta", $id, "{$prefix}{$name}", false);
141
- return isset($meta[0]) ? $meta[0] : null;
142
- } else {
143
  return get_option( "{$prefix}{$id}_{$name}", null );
 
 
 
144
  }
145
  }
146
 
@@ -162,10 +166,10 @@ function acf_update_metadata( $post_id = 0, $name = '', $value = '', $hidden = f
162
 
163
  // Allow filter to short-circuit logic.
164
  $pre = apply_filters( "acf/pre_update_metadata", null, $post_id, $name, $value, $hidden );
165
- if( $pre !== null ) {
166
- return $pre;
167
- }
168
-
169
  // Decode $post_id for $type and $id.
170
  extract( acf_decode_post_id($post_id) );
171
 
@@ -178,13 +182,14 @@ function acf_update_metadata( $post_id = 0, $name = '', $value = '', $hidden = f
178
  }
179
 
180
  // Determine CRUD function.
181
- if( function_exists("update_{$type}_meta") ) {
182
- return call_user_func("update_{$type}_meta", $id, "{$prefix}{$name}", $value);
183
- } else {
184
- // Unslash value to match update_metadata() functionality.
185
  $value = wp_unslash( $value );
186
  $autoload = (bool) acf_get_setting('autoload');
187
  return update_option( "{$prefix}{$id}_{$name}", $value, $autoload );
 
 
188
  }
189
  }
190
 
@@ -205,10 +210,10 @@ function acf_delete_metadata( $post_id = 0, $name = '', $hidden = false ) {
205
 
206
  // Allow filter to short-circuit logic.
207
  $pre = apply_filters( "acf/pre_delete_metadata", null, $post_id, $name, $hidden );
208
- if( $pre !== null ) {
209
- return $pre;
210
- }
211
-
212
  // Decode $post_id for $type and $id.
213
  extract( acf_decode_post_id($post_id) );
214
 
@@ -221,11 +226,12 @@ function acf_delete_metadata( $post_id = 0, $name = '', $hidden = false ) {
221
  }
222
 
223
  // Determine CRUD function.
224
- if( function_exists("delete_{$type}_meta") ) {
225
- return call_user_func("delete_{$type}_meta", $id, "{$prefix}{$name}");
226
- } else {
227
- $autoload = (bool) acf_get_setting('autoload');
228
  return delete_option( "{$prefix}{$id}_{$name}" );
 
 
229
  }
230
  }
231
 
15
 
16
  // Allow filter to short-circuit load_value logic.
17
  $null = apply_filters( "acf/pre_load_meta", null, $post_id );
18
+ if( $null !== null ) {
19
+ return ( $null === '__return_null' ) ? null : $null;
20
+ }
21
+
22
  // Decode $post_id for $type and $id.
23
  extract( acf_decode_post_id($post_id) );
24
 
25
  // Determine CRUD function.
26
+ // - Relies on decoded post_id result to identify option or meta types.
27
+ // - Uses xxx_metadata(type) instead of xxx_type_meta() to bypass additional logic that could alter the ID.
28
+ if( $type === 'option' ) {
29
  $allmeta = acf_get_option_meta( $id );
30
+ } else {
31
+ $allmeta = get_metadata( $type, $id, '' );
32
  }
33
 
34
  // Loop over meta and check that a reference exists for each value.
122
 
123
  // Allow filter to short-circuit logic.
124
  $null = apply_filters( "acf/pre_load_metadata", null, $post_id, $name, $hidden );
125
+ if( $null !== null ) {
126
+ return ( $null === '__return_null' ) ? null : $null;
127
+ }
128
+
129
  // Decode $post_id for $type and $id.
130
  extract( acf_decode_post_id($post_id) );
131
 
138
  }
139
 
140
  // Determine CRUD function.
141
+ // - Relies on decoded post_id result to identify option or meta types.
142
+ // - Uses xxx_metadata(type) instead of xxx_type_meta() to bypass additional logic that could alter the ID.
143
+ if( $type === 'option' ) {
 
144
  return get_option( "{$prefix}{$id}_{$name}", null );
145
+ } else {
146
+ $meta = get_metadata( $type, $id, "{$prefix}{$name}", false );
147
+ return isset($meta[0]) ? $meta[0] : null;
148
  }
149
  }
150
 
166
 
167
  // Allow filter to short-circuit logic.
168
  $pre = apply_filters( "acf/pre_update_metadata", null, $post_id, $name, $value, $hidden );
169
+ if( $pre !== null ) {
170
+ return $pre;
171
+ }
172
+
173
  // Decode $post_id for $type and $id.
174
  extract( acf_decode_post_id($post_id) );
175
 
182
  }
183
 
184
  // Determine CRUD function.
185
+ // - Relies on decoded post_id result to identify option or meta types.
186
+ // - Uses xxx_metadata(type) instead of xxx_type_meta() to bypass additional logic that could alter the ID.
187
+ if( $type === 'option' ) {
 
188
  $value = wp_unslash( $value );
189
  $autoload = (bool) acf_get_setting('autoload');
190
  return update_option( "{$prefix}{$id}_{$name}", $value, $autoload );
191
+ } else {
192
+ return update_metadata( $type, $id, "{$prefix}{$name}", $value );
193
  }
194
  }
195
 
210
 
211
  // Allow filter to short-circuit logic.
212
  $pre = apply_filters( "acf/pre_delete_metadata", null, $post_id, $name, $hidden );
213
+ if( $pre !== null ) {
214
+ return $pre;
215
+ }
216
+
217
  // Decode $post_id for $type and $id.
218
  extract( acf_decode_post_id($post_id) );
219
 
226
  }
227
 
228
  // Determine CRUD function.
229
+ // - Relies on decoded post_id result to identify option or meta types.
230
+ // - Uses xxx_metadata(type) instead of xxx_type_meta() to bypass additional logic that could alter the ID.
231
+ if( $type === 'option' ) {
 
232
  return delete_option( "{$prefix}{$id}_{$name}" );
233
+ } else {
234
+ return delete_metadata( $type, $id, "{$prefix}{$name}" );
235
  }
236
  }
237
 
includes/acf-wp-functions.php CHANGED
@@ -184,8 +184,9 @@ function acf_decode_post_id( $post_id = 0 ) {
184
  $type = 'option';
185
  $id = $post_id;
186
  break;
 
187
  case 'site_%d':
188
- $type = 'site';
189
  $id = absint( $id );
190
  break;
191
  default:
184
  $type = 'option';
185
  $id = $post_id;
186
  break;
187
+ case 'blog_%d':
188
  case 'site_%d':
189
+ $type = 'blog';
190
  $id = absint( $id );
191
  break;
192
  default:
includes/fields/class-acf-field-relationship.php CHANGED
@@ -643,7 +643,7 @@ class acf_field_relationship extends acf_field {
643
  /*
644
  * format_value()
645
  *
646
- * This filter is appied to the $value after it is loaded from the db and before it is returned to the template
647
  *
648
  * @type filter
649
  * @since 3.6
@@ -733,7 +733,7 @@ class acf_field_relationship extends acf_field {
733
  /*
734
  * update_value()
735
  *
736
- * This filter is appied to the $value before it is updated in the db
737
  *
738
  * @type filter
739
  * @since 3.6
@@ -777,4 +777,4 @@ acf_register_field_type( 'acf_field_relationship' );
777
 
778
  endif; // class_exists check
779
 
780
- ?>
643
  /*
644
  * format_value()
645
  *
646
+ * This filter is applied to the $value after it is loaded from the db and before it is returned to the template
647
  *
648
  * @type filter
649
  * @since 3.6
733
  /*
734
  * update_value()
735
  *
736
+ * This filter is applied to the $value before it is updated in the db
737
  *
738
  * @type filter
739
  * @since 3.6
777
 
778
  endif; // class_exists check
779
 
780
+ ?>
readme.txt CHANGED
@@ -67,6 +67,12 @@ From your WordPress dashboard
67
 
68
  == Changelog ==
69
 
 
 
 
 
 
 
70
  = 5.9.2 =
71
  *Release Date - 29 October 2020*
72
 
67
 
68
  == Changelog ==
69
 
70
+ = 5.9.3 =
71
+ *Release Date - 3 November 2020*
72
+
73
+ * Fix - Fixed bug causing Revision meta to incorrectly update the parent Post meta.
74
+ * Fix - Fixed bug breaking "Filter by Post Type" and "Filter by Taxonomy" Field settings.
75
+
76
  = 5.9.2 =
77
  *Release Date - 29 October 2020*
78