mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-29 23:57:41 +02:00
Notify developers when register_post_type() or register_taxonomy() fails because of post type or taxonomy key length.
props mattheweppelsheimer. fixes #28683. Built from https://develop.svn.wordpress.org/trunk@28902 git-svn-id: http://core.svn.wordpress.org/trunk@28701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6216aa2331
commit
a8d0832a15
@ -1243,8 +1243,10 @@ function register_post_type( $post_type, $args = array() ) {
|
|||||||
$post_type = sanitize_key( $post_type );
|
$post_type = sanitize_key( $post_type );
|
||||||
$args->name = $post_type;
|
$args->name = $post_type;
|
||||||
|
|
||||||
if ( strlen( $post_type ) > 20 )
|
if ( strlen( $post_type ) > 20 ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Post types cannot exceed 20 characters in length' ), '4.0' );
|
||||||
return new WP_Error( 'post_type_too_long', __( 'Post types cannot exceed 20 characters in length' ) );
|
return new WP_Error( 'post_type_too_long', __( 'Post types cannot exceed 20 characters in length' ) );
|
||||||
|
}
|
||||||
|
|
||||||
// If not set, default to the setting for public.
|
// If not set, default to the setting for public.
|
||||||
if ( null === $args->publicly_queryable )
|
if ( null === $args->publicly_queryable )
|
||||||
|
@ -346,8 +346,10 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
|
|||||||
);
|
);
|
||||||
$args = wp_parse_args( $args, $defaults );
|
$args = wp_parse_args( $args, $defaults );
|
||||||
|
|
||||||
if ( strlen( $taxonomy ) > 32 )
|
if ( strlen( $taxonomy ) > 32 ) {
|
||||||
|
_doing_it_wrong( __FUNCTION__, __( 'Taxonomies cannot exceed 32 characters in length' ), '4.0' );
|
||||||
return new WP_Error( 'taxonomy_too_long', __( 'Taxonomies cannot exceed 32 characters in length' ) );
|
return new WP_Error( 'taxonomy_too_long', __( 'Taxonomies cannot exceed 32 characters in length' ) );
|
||||||
|
}
|
||||||
|
|
||||||
if ( false !== $args['query_var'] && ! empty( $wp ) ) {
|
if ( false !== $args['query_var'] && ! empty( $wp ) ) {
|
||||||
if ( true === $args['query_var'] )
|
if ( true === $args['query_var'] )
|
||||||
|
Loading…
Reference in New Issue
Block a user