From 26a7e29b815aeb852340f4e07f4f8d872dae002a Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Wed, 18 Nov 2015 19:58:21 +0000 Subject: [PATCH] Allow filtering by non-public taxonomies on edit.php. [35333] enforces protection for taxonomies by preventing non-public taxonomies from registering query_vars in `register_taxonomy()`. This broke the use of taxonomy query_vars on edit.php, breaking backward compatibility and creating inconsistency with the treatment introduced in [34247], which allowed `taxonomy=foo` filtering on the Dashboard, even when `foo` is non-public. In this changeset, we make the same Dashboard exception for the query_var. Fixes #21949. git-svn-id: https://develop.svn.wordpress.org/trunk@35680 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/taxonomy-functions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/taxonomy-functions.php b/src/wp-includes/taxonomy-functions.php index 035f18b0d4..3d65ba3345 100644 --- a/src/wp-includes/taxonomy-functions.php +++ b/src/wp-includes/taxonomy-functions.php @@ -384,7 +384,8 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { return new WP_Error( 'taxonomy_length_invalid', __( 'Taxonomy names must be between 1 and 32 characters in length.' ) ); } - if ( false !== $args['query_var'] && false !== $args['public'] && ! empty( $wp ) ) { + // Non-public taxonomies should not register query vars, except in the admin. + if ( false !== $args['query_var'] && ( is_admin() || false !== $args['public'] ) && ! empty( $wp ) ) { if ( true === $args['query_var'] ) $args['query_var'] = $taxonomy; else