mirror of
git://develop.git.wordpress.org/
synced 2025-04-27 23:53:02 +02:00
Themes: Make sure the theme API response is not an error before operating on it in themes_api()
.
This fixes a potential bug and avoids PHP warnings when `themes_api( 'query_themes' )` is called and a successful API response is not received. Follow-up to [42632]. Props pierlo. Fixes #53913. git-svn-id: https://develop.svn.wordpress.org/trunk@51601 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
18024e62d7
commit
27098883f9
@ -602,15 +602,18 @@ function themes_api( $action, $args = array() ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Back-compat for info/1.2 API, upgrade the theme objects in query_themes to objects.
|
||||
if ( 'query_themes' === $action ) {
|
||||
foreach ( $res->themes as $i => $theme ) {
|
||||
$res->themes[ $i ] = (object) $theme;
|
||||
if ( ! is_wp_error( $res ) ) {
|
||||
// Back-compat for info/1.2 API, upgrade the theme objects in query_themes to objects.
|
||||
if ( 'query_themes' === $action ) {
|
||||
foreach ( $res->themes as $i => $theme ) {
|
||||
$res->themes[ $i ] = (object) $theme;
|
||||
}
|
||||
}
|
||||
|
||||
// Back-compat for info/1.2 API, downgrade the feature_list result back to an array.
|
||||
if ( 'feature_list' === $action ) {
|
||||
$res = (array) $res;
|
||||
}
|
||||
}
|
||||
// Back-compat for info/1.2 API, downgrade the feature_list result back to an array.
|
||||
if ( 'feature_list' === $action ) {
|
||||
$res = (array) $res;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user