give static var initial value, fixes #13517
git-svn-id: http://svn.automattic.com/wordpress/trunk@14867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a4e59b62eb
commit
569642dd32
|
@ -1210,14 +1210,14 @@ function fix_import_form_size( $size ) {
|
||||||
*/
|
*/
|
||||||
function global_terms( $term_id, $deprecated = '' ) {
|
function global_terms( $term_id, $deprecated = '' ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
static $global_terms_recurse;
|
static $global_terms_recurse = null;
|
||||||
|
|
||||||
if ( !global_terms_enabled() )
|
if ( !global_terms_enabled() )
|
||||||
return $term_id;
|
return $term_id;
|
||||||
|
|
||||||
// prevent a race condition
|
// prevent a race condition
|
||||||
$recurse_start = false;
|
$recurse_start = false;
|
||||||
if ( !isset( $global_terms_recurse ) ) {
|
if ( $global_terms_recurse === null ) {
|
||||||
$recurse_start = true;
|
$recurse_start = true;
|
||||||
$global_terms_recurse = 1;
|
$global_terms_recurse = 1;
|
||||||
} elseif ( 10 < $global_terms_recurse++ ) {
|
} elseif ( 10 < $global_terms_recurse++ ) {
|
||||||
|
@ -1258,7 +1258,7 @@ function global_terms( $term_id, $deprecated = '' ) {
|
||||||
clean_term_cache($term_id);
|
clean_term_cache($term_id);
|
||||||
}
|
}
|
||||||
if( $recurse_start )
|
if( $recurse_start )
|
||||||
unset( $global_terms_recurse );
|
$global_terms_recurse = null;
|
||||||
|
|
||||||
return $global_id;
|
return $global_id;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue