| @@ -18,8 +18,13 @@ | ||
| 18 | 18 | */ |
| 19 | 19 | public function respond( $args ) { |
| 20 | 20 | $response = []; |
| 21 | 21 | |
| 22 | + // Update the update cache if requested. | |
| 23 | + if ( isset( $args['force'] ) && $args['force'] === 'true' ) { | |
| 24 | + wp_update_themes(); | |
| 25 | + } | |
| 26 | + | |
| 22 | 27 | $themes = wp_get_themes(); |
| 23 | 28 | $updates = get_site_transient( 'update_themes' ); |
| 24 | 29 | |
| 25 | 30 | foreach ( $themes as $key => $theme ) { |
| @@ -33,9 +38,9 @@ | ||
| 33 | 38 | 'author' => $theme->get( 'Author' ), |
| 34 | 39 | 'author_uri' => $theme->get( 'AuthorURI' ), |
| 35 | 40 | 'status' => $this->get_status( $theme ), |
| 36 | 41 | 'update_available' => $update ? true : false, |
| 37 | - 'new_version' => $update ? $update['new_version'] : null, | |
| 42 | + 'new_version' => $update && isset( $update['new_version'] ) ? $update['new_version'] : null, | |
| 38 | 43 | ]; |
| 39 | 44 | } |
| 40 | 45 | |
| 41 | 46 | wp_send_json( $response ); |