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
This commit is contained in:
Boone Gorges 2015-11-18 19:58:21 +00:00
parent 56d7611f09
commit 26a7e29b81

View File

@ -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