Ticket #31135: 31135.5.diff
File 31135.5.diff, 1.6 KB (added by , 10 years ago) |
---|
-
src/wp-includes/taxonomy.php
341 341 ); 342 342 $args = wp_parse_args( $args, $defaults ); 343 343 344 if ( strlen( $taxonomy ) > 32 ) {345 _doing_it_wrong( __FUNCTION__, __( 'Taxonomies cannot exceed 32 characters in length' ), '4.0' );346 return new WP_Error( 'taxonomy_ too_long', __( 'Taxonomies cannot exceed 32 characters in length' ) );344 if ( empty( $taxonomy ) || strlen( $taxonomy ) > 32 ) { 345 _doing_it_wrong( __FUNCTION__, __( 'Taxonomies must be between 1 and 32 characters in length.' ), '4.2' ); 346 return new WP_Error( 'taxonomy_length_invalid', __( 'Taxonomies must be between 1 and 32 characters in length.' ) ); 347 347 } 348 348 349 349 if ( false !== $args['query_var'] && ! empty( $wp ) ) { 350 if ( true === $args['query_var'] ) 350 if ( true === $args['query_var'] ) { 351 351 $args['query_var'] = $taxonomy; 352 else352 } else { 353 353 $args['query_var'] = sanitize_title_with_dashes( $args['query_var'] ); 354 } 354 355 $wp->add_query_var( $args['query_var'] ); 355 356 } 356 357 -
tests/phpunit/tests/taxonomy.php
154 154 } 155 155 156 156 /** 157 * @ticket 31135 158 * 159 * @expectedIncorrectUsage register_taxonomy 160 */ 161 function test_register_short_taxonomy() { 162 $this->assertInstanceOf( 'WP_Error', register_taxonomy( '', 'post', array() ) ); 163 } 164 165 /** 157 166 * @ticket 21593 158 167 * 159 168 * @expectedIncorrectUsage register_taxonomy