mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Ensure that get_terms()
can accept querystring-style arguments.
Prior to [37572], arguments passed to `get_terms()` were passed immediately through `wp_parse_args()`, which made it possible to pass arguments as a querystring (`hide_empty=0`) rather than an array (`array( 'hide_empty' => false )`). [37572] moved default argument parsing into `WP_Term_Query`, while assuming that arguments passed to `get_terms()` would be formatted as an array. To provide compatibility, we now parse all args passed to `get_terms()` into an array before processing. See #35381. Built from https://develop.svn.wordpress.org/trunk@37599 git-svn-id: http://core.svn.wordpress.org/trunk@37567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c959b63539
commit
477f6346eb
@ -1183,15 +1183,19 @@ function get_terms( $args = array(), $deprecated = '' ) {
|
||||
* (a) a second non-empty parameter is passed, or
|
||||
* (b) the first parameter shares no keys with the default array (ie, it's a list of taxonomies)
|
||||
*/
|
||||
$key_intersect = array_intersect_key( $term_query->query_var_defaults, (array) $args );
|
||||
$_args = wp_parse_args( $args );
|
||||
$key_intersect = array_intersect_key( $term_query->query_var_defaults, (array) $_args );
|
||||
$do_legacy_args = $deprecated || empty( $key_intersect );
|
||||
|
||||
if ( $do_legacy_args ) {
|
||||
$taxonomies = (array) $args;
|
||||
$args = $deprecated;
|
||||
$args = wp_parse_args( $deprecated );
|
||||
$args['taxonomy'] = $taxonomies;
|
||||
} elseif ( isset( $args['taxonomy'] ) && null !== $args['taxonomy'] ) {
|
||||
$args['taxonomy'] = (array) $args['taxonomy'];
|
||||
} else {
|
||||
$args = wp_parse_args( $args );
|
||||
if ( isset( $args['taxonomy'] ) && null !== $args['taxonomy'] ) {
|
||||
$args['taxonomy'] = (array) $args['taxonomy'];
|
||||
}
|
||||
}
|
||||
|
||||
$empty_array = array();
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.6-alpha-37598';
|
||||
$wp_version = '4.6-alpha-37599';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user