Repository navigation
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
| $response = array( | ||
| 'errorMessage' => $api->get_error_message(), | ||
| ); |
There was a problem hiding this comment.
We are including errorMessage in the AJAX response, but the JavaScript doesn't currently use it. Could we either display this message or remove it from the response to avoid sending unused data?
Description
When the external HTTP request to the WordPress.org Themes API fails (for example, when
WP_HTTP_BLOCK_EXTERNALis set totrue), the "Add Themes" screen (wp-admin/theme-install.php) only displays a generic fallback error message without showing the underlying error details returned by the server.This PR passes the error message from the AJAX handler and renders it inside the error notice in the UI, matching the existing error-reporting behavior used in the Plugin Installer screen:
src/wp-admin/includes/ajax-actions.php: Retrieves$api->get_error_data(), strips HTML tags viawp_strip_all_tags(), and includeserrorDatain the JSON error response whenthemes_api()returns aWP_Errorinwp_ajax_query_themes().src/js/_enqueues/wp/theme.js: Forwards theresponseobject from both.fail()callbacks to thequery:failevent and appends a paragraph withError details:whenresponse.errorDatais present.Screenshots
| Before |
| After |
Testing Instructions
define( 'WP_HTTP_BLOCK_EXTERNAL', true );towp-config.php.wp-admin/theme-install.php).Error details: User has blocked requests through HTTP...below the generic message.define( 'WP_HTTP_BLOCK_EXTERNAL', true );fromwp-config.phpand verify that the theme directory loads normally again.Trac ticket: https://core.trac.wordpress.org/ticket/66712
Use of AI Tools
AI assistance: Yes
Tool(s): Google Gemini
Used for: Guidance
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.