From c50eaf3b0d8f2a741ea820d45ff4d6cf9d1c213f Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 1 Nov 2014 22:53:35 +0000 Subject: [PATCH] In `wp_ajax_get_tagcloud()`, bail immediately if `$_POST['tax']` isn't set so that all of the variable setting can happen in the same nest scope as the rest of the function - `wp_die()` confuses Scrutinizer. See #30224. git-svn-id: https://develop.svn.wordpress.org/trunk@30168 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/ajax-actions.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 071514453d..a4835b77e5 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -819,17 +819,20 @@ function wp_ajax_add_tag() { * @since 3.1.0 */ function wp_ajax_get_tagcloud() { - if ( isset( $_POST['tax'] ) ) { - $taxonomy = sanitize_key( $_POST['tax'] ); - $tax = get_taxonomy( $taxonomy ); - if ( ! $tax ) - wp_die( 0 ); - if ( ! current_user_can( $tax->cap->assign_terms ) ) - wp_die( -1 ); - } else { + if ( ! isset( $_POST['tax'] ) ) { wp_die( 0 ); } + $taxonomy = sanitize_key( $_POST['tax'] ); + $tax = get_taxonomy( $taxonomy ); + if ( ! $tax ) { + wp_die( 0 ); + } + + if ( ! current_user_can( $tax->cap->assign_terms ) ) { + wp_die( -1 ); + } + $tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) ); if ( empty( $tags ) )