WordPress.org

Make WordPress Core

Changeset 48505


Ignore:
Timestamp:
07/17/2020 03:14:00 PM (2 months ago)
Author:
SergeyBiryukov
Message:

Options, Meta APIs: Reorder the parameters of default_{$meta_type}_metadata filter.

This brings consistency with the get_{$meta_type}_metadata filter and more closely matches the get_metadata_default() function signature.

Follow-up to [48502].

Props spacedmonkey.
See #43941.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/meta.php

    r48504 r48505  
    545545     *
    546546     * @since 3.1.0
     547     * @since 5.5.0 Added the `$meta_type` parameter.
    547548     *
    548549     * @param mixed  $value     The value to return, either a single metadata value or an array
     
    551552     * @param string $meta_key  Metadata key.
    552553     * @param bool   $single    Whether to return only the first value of the specified `$meta_key`.
     554     * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
     555     *                          or any other object type with an associated meta table.
    553556     */
    554     $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
     557    $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single, $meta_type );
    555558    if ( null !== $check ) {
    556559        if ( $single && is_array( $check ) ) {
     
    619622     * @param mixed  $value     The value to return, either a single metadata value or an array
    620623     *                          of values depending on the value of `$single`.
     624     * @param int    $object_id ID of the object metadata is for.
     625     * @param string $meta_key  Metadata key.
     626     * @param bool   $single    Whether to return only the first value of the specified `$meta_key`.
    621627     * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
    622628     *                          or any other object type with an associated meta table.
    623      * @param string $meta_key  Metadata key.
    624      * @param bool   $single    Whether to return only the first value of the specified `$meta_key`.
    625      * @param int    $object_id ID of the object metadata is for.
    626629     */
    627     $value = apply_filters( "default_{$meta_type}_metadata", $value, $meta_type, $meta_key, $single, $object_id );
     630    $value = apply_filters( "default_{$meta_type}_metadata", $value, $object_id, $meta_key, $single, $meta_type );
    628631
    629632    if ( ! $single && ! wp_is_numeric_array( $value ) ) {
     
    13801383 *
    13811384 * @param mixed  $value     Current value passed to filter.
    1382  * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
    1383  *                          or any other object type with an associated meta table.
     1385 * @param int    $object_id ID of the object metadata is for.
    13841386 * @param string $meta_key  Metadata key.
    13851387 * @param bool   $single    If true, return only the first value of the specified meta_key.
    13861388 *                          This parameter has no effect if meta_key is not specified.
    1387  * @param int    $object_id ID of the object metadata is for.
     1389 * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
     1390 *                          or any other object type with an associated meta table.
    13881391 * @return mixed Single metadata default, or array of defaults.
    13891392 */
    1390 function filter_default_metadata( $value, $meta_type, $meta_key, $single, $object_id ) {
     1393function filter_default_metadata( $value, $object_id, $meta_key, $single, $meta_type ) {
    13911394    global $wp_meta_keys;
    13921395
Note: See TracChangeset for help on using the changeset viewer.