From eefe6b0779202310889c72c7d4477df855d91060 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Sun, 27 Dec 2015 16:41:27 +0000 Subject: [PATCH] Force non-public taxonomies to have a query_var of `false`. [35333] implemented `public=false` for taxonomies. The implementation prevented non-public taxonomies from having their archives accessed via query_var during a normal request. But it didn't prevent non-public taxonomies from registering their query vars in the `$wp_taxonomies` global. The latter implementation details causes problems specifically when a taxonomy is registered with `query_var=true`; for public taxonomies, `register_taxonomy()` translates this into a query_var equivalent to the taxonomy name, but in the case of non-public taxonomies, the query_var was set to the boolean itself. The boolean then causes problems when using non-strict comparison to filter taxonomy objects by query_var, as when using `get_taxonomies()`. This changeset addresses the issue by forcing the query_var property of non-public taxonomies to `false`. Fixes #35089. Built from https://develop.svn.wordpress.org/trunk@36108 git-svn-id: http://core.svn.wordpress.org/trunk@36073 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 3 +++ wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 8cbef3c718..9865f42be7 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -390,6 +390,9 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { else $args['query_var'] = sanitize_title_with_dashes( $args['query_var'] ); $wp->add_query_var( $args['query_var'] ); + } else { + // Force query_var to false for non-public taxonomies. + $args['query_var'] = false; } if ( false !== $args['rewrite'] && ( is_admin() || '' != get_option( 'permalink_structure' ) ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index e3f68b8dcc..d54a9b4c8a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36107'; +$wp_version = '4.5-alpha-36108'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.