Coding Standards: Use Yoda conditions where appropriate.
See #49222. Built from https://develop.svn.wordpress.org/trunk@47219 git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -127,7 +127,7 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ
|
||||
$category_paths = explode( '/', $category_paths );
|
||||
$full_path = '';
|
||||
foreach ( (array) $category_paths as $pathdir ) {
|
||||
$full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title( $pathdir );
|
||||
$full_path .= ( '' != $pathdir ? '/' : '' ) . sanitize_title( $pathdir );
|
||||
}
|
||||
$categories = get_terms(
|
||||
array(
|
||||
@@ -144,7 +144,7 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ
|
||||
foreach ( $categories as $category ) {
|
||||
$path = '/' . $leaf_path;
|
||||
$curcategory = $category;
|
||||
while ( ( $curcategory->parent != 0 ) && ( $curcategory->parent != $curcategory->term_id ) ) {
|
||||
while ( ( 0 != $curcategory->parent ) && ( $curcategory->parent != $curcategory->term_id ) ) {
|
||||
$curcategory = get_term( $curcategory->parent, 'category' );
|
||||
if ( is_wp_error( $curcategory ) ) {
|
||||
return $curcategory;
|
||||
|
||||
Reference in New Issue
Block a user