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.


git-svn-id: https://develop.svn.wordpress.org/trunk@38095 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt
2016-07-18 21:15:37 +00:00
parent ff6d8819e4
commit 4f2008a104
3 changed files with 119 additions and 336 deletions

View File

@@ -5357,31 +5357,6 @@ function mysql_to_rfc3339( $date_string ) {
return preg_replace( '/(?:Z|[+-]\d{2}(?::\d{2})?)$/', '', $formatted );
}
/**
* Check if an object type exists. By default, these are `post`, `comment`, `user`, and `term`.
*
* @since 4.6.0
*
* @param string $object_type Object type to check.
* @return bool True if the object type exists, false if not.
*/
function wp_object_type_exists( $object_type ) {
/**
* Filters WordPress object types.
*
* @since 4.6.0
*
* @param array $types Array of object types.
*/
$types = apply_filters( 'wp_object_types', array( 'post', 'comment', 'user', 'term' ) );
if ( in_array( $object_type, $types ) ) {
return true;
}
return false;
}
/**
* Attempts to raise the PHP memory limit for memory intensive processes.
*