Ticket #35658: 35658.24.diff
File 35658.24.diff, 1.9 KB (added by , 8 years ago) |
---|
-
src/wp-includes/meta.php
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_callback Deprecated. Use `$args` instead.1006 * @param string|array $deprecated Optional. Deprecated. Default null. 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 1041 $has_old_sanitize_cb = true; 1041 1042 } else { 1042 $args = $passed_args[0];1043 $args = (array) $args; 1043 1044 } 1044 1045 1045 if ( is set( $passed_args[1] ) && is_callable( $passed_args[1]) ) {1046 $args['auth_callback'] = $ passed_args[1];1046 if ( is_callable( $deprecated ) ) { 1047 $args['auth_callback'] = $deprecated; 1047 1048 } 1048 1049 1049 1050 $args = wp_parse_args( $args, $defaults );