WordPress.org

Make WordPress Core

Ticket #21949: 21949.4.diff

File 21949.4.diff, 782 bytes (added by boonebgorges, 5 years ago)
  • src/wp-includes/taxonomy-functions.php

    diff --git src/wp-includes/taxonomy-functions.php src/wp-includes/taxonomy-functions.php
    index 035f18b..3d65ba3 100644
    function register_taxonomy( $taxonomy, $object_type, $args = array() ) { 
    384384                return new WP_Error( 'taxonomy_length_invalid', __( 'Taxonomy names must be between 1 and 32 characters in length.' ) );
    385385        }
    386386
    387         if ( false !== $args['query_var'] && false !== $args['public'] && ! empty( $wp ) ) {
     387        // Non-public taxonomies should not register query vars, except in the admin.
     388        if ( false !== $args['query_var'] && ( is_admin() || false !== $args['public'] ) && ! empty( $wp ) ) {
    388389                if ( true === $args['query_var'] )
    389390                        $args['query_var'] = $taxonomy;
    390391                else