WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/18/2016 09:15:37 PM (5 years ago)
Author:
jeremyfelt
Message:

Meta: Remove object subtype handling from register_meta().

Registration is now based solely on object type, which allows the code around this to be simplified significantly.

In the process of making this adjustment:

  • register_meta(), unregister_meta_key(), get_registered_metadata(), and registered_meta_key_exists() no longer return WP_Error objects.
  • The recently introduced wp_object_type_exists() function and the restriction on object type has been removed.

Note: No guarantee of uniqueness is made across object subtypes. Registered meta keys should be uniquely prefixed to avoid conflict.

Fixes #35658.

File:
1 edited

Legend:

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

    r38038 r38095  
    53595359
    53605360/**
    5361  * Check if an object type exists. By default, these are `post`, `comment`, `user`, and `term`.
    5362  *
    5363  * @since 4.6.0
    5364  *
    5365  * @param  string $object_type Object type to check.
    5366  * @return bool                True if the object type exists, false if not.
    5367  */
    5368 function wp_object_type_exists( $object_type ) {
    5369     /**
    5370      * Filters WordPress object types.
    5371      *
    5372      * @since 4.6.0
    5373      *
    5374      * @param array  $types Array of object types.
    5375      */
    5376     $types = apply_filters( 'wp_object_types', array( 'post', 'comment', 'user', 'term' ) );
    5377 
    5378     if ( in_array( $object_type, $types ) ) {
    5379         return true;
    5380     }
    5381 
    5382     return false;
    5383 }
    5384 
    5385 /**
    53865361 * Attempts to raise the PHP memory limit for memory intensive processes.
    53875362 *
Note: See TracChangeset for help on using the changeset viewer.