WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/06/2016 06:08:55 PM (3 years ago)
Author:
helen
Message:

Meta: Make registration error conditions return consistently.

In doing this, non-core object types are no longer forcibly blocked and are instead checked against wp_object_type_exists() which has a filterable return value. Still, filter that at your own risk.

props Faison for the initial patch.
see 35658.

File:
1 edited

Legend:

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

    r37985 r37991  
    53575357    return preg_replace( '/(?:Z|[+-]\d{2}(?::\d{2})?)$/', '', $formatted );
    53585358}
     5359
     5360/**
     5361 * Check if an object type exists. By default, these are `post`, `comment`, `user`, and `term`.
     5362 *
     5363 * @param  string $object_type Object type to check.
     5364 * @return bool                True if the object type exists, false if not.
     5365 */
     5366function wp_object_type_exists( $object_type ) {
     5367    /**
     5368     * Filters WordPress object types.
     5369     *
     5370     * @since 4.6.0
     5371     *
     5372     * @param array  $types Array of object types.
     5373     */
     5374    $types = apply_filters( 'wp_object_types', array( 'post', 'comment', 'user', 'term' ) );
     5375
     5376    if ( in_array( $object_type, $types ) ) {
     5377        return true;
     5378    }
     5379
     5380    return false;
     5381}
Note: See TracChangeset for help on using the changeset viewer.