Ticket #35658: 35658.23.diff
File 35658.23.diff, 2.1 KB (added by , 8 years ago) |
---|
-
src/wp-includes/meta.php
981 981 */ 982 982 return apply_filters( "sanitize_{$object_type}_meta_{$meta_key}", $meta_value, $meta_key, $object_type, $object_subtype ); 983 983 984 984 985 985 } 986 986 987 987 /** … … 1003 1003 * @type string $auth_callback Optional. A function or method to call when performing edit_post_meta, add_post_meta, and delete_post_meta capability checks. 1004 1004 * @type bool $show_in_rest Whether data associated with this meta key can be considered public. 1005 1005 * } 1006 * @param string|array $ auth_callbackDeprecated. Use `$args` instead.1006 * @param string|array $deprecated Deprecated. Use `$args` instead. 1007 1007 * 1008 1008 * @return bool True if the meta key was successfully registered in the global array, false if not. 1009 1009 * Registering a meta key with distinct sanitize and auth callbacks will fire those 1010 1010 * callbacks, but will not add to the global registry as it requires a subtype. 1011 1011 */ 1012 function register_meta( $object_type, $meta_key, $args, $ auth_callback= null ) {1012 function register_meta( $object_type, $meta_key, $args, $deprecated = null ) { 1013 1013 global $wp_meta_keys; 1014 1014 1015 1015 if ( ! is_array( $wp_meta_keys ) ) { … … 1030 1030 'show_in_rest' => false, 1031 1031 ); 1032 1032 1033 $passed_args = array_slice( func_get_args(), 2 );1034 1035 1033 // There used to be individual args for sanitize and auth callbacks 1036 1034 $has_old_sanitize_cb = false; 1037 1035 1038 if ( is_callable( $passed_args[0] ) ) { 1039 $args['sanitize_callback'] = $passed_args[0]; 1036 if ( is_callable( $args ) ) { 1037 $args = array( 1038 'sanitize_callback' => $args, 1039 ); 1040 1040 $has_old_sanitize_cb = true; 1041 1041 } else { 1042 $args = $passed_args[0];1042 $args = (array) $args; 1043 1043 } 1044 1044 1045 if ( isset( $ passed_args[1] ) && is_callable( $passed_args[1]) ) {1046 $args['auth_callback'] = $ passed_args[1];1045 if ( isset( $deprecated ) && is_callable( $deprecated ) ) { 1046 $args['auth_callback'] = $deprecated; 1047 1047 } 1048 1048 1049 1049 $args = wp_parse_args( $args, $defaults );