Make WordPress Core

Ticket #35658: 35658.39.diff

File 35658.39.diff, 2.2 KB (added by jeremyfelt, 8 years ago)
  • src/wp-includes/meta.php

     
    1717 *
    1818 * @global wpdb $wpdb WordPress database abstraction object.
    1919 *
    20  * @param string $meta_type  Type of object metadata is for (e.g., comment, post, or user)
    21  * @param int    $object_id  ID of the object metadata is for
    22  * @param string $meta_key   Metadata key
    23  * @param mixed  $meta_value Metadata value. Must be serializable if non-scalar.
    24  * @param bool   $unique     Optional, default is false.
    25  *                           Whether the specified metadata key should be unique for the object.
    26  *                           If true, and the object already has a value for the specified metadata key,
    27  *                           no change will be made.
     20 * @param string $meta_type      Type of object metadata is for (e.g., comment, post, or user)
     21 * @param int    $object_id      ID of the object metadata is for
     22 * @param string $meta_key       Metadata key
     23 * @param mixed  $meta_value     Metadata value. Must be serializable if non-scalar.
     24 * @param bool   $unique         Optional, default is false.
     25 *                               Whether the specified metadata key should be unique for the object.
     26 *                               If true, and the object already has a value for the specified metadata key,
     27 *                               no change will be made.
     28 * @param string $object_subtype Optional. Subtype of object.
    2829 * @return int|false The meta ID on success, false on failure.
    2930 */
    30 function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = false) {
     31function add_metadata( $meta_type, $object_id, $meta_key, $meta_value, $unique = false, $object_subtype = '' ) {
    3132        global $wpdb;
    3233
    3334        if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) ) {
     
    4950        // expected_slashed ($meta_key)
    5051        $meta_key = wp_unslash($meta_key);
    5152        $meta_value = wp_unslash($meta_value);
    52         $meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type );
     53        $meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type, $object_subtype );
    5354
    5455        /**
    5556         * Filters whether to add metadata of a specific type.