Widgets: Avoid repeated get_option() calls in wp_widget_rss_output() - #13594
mukeshpanchal27 wants to merge 1 commit into
Conversation
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. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the 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. |
There was a problem hiding this comment.
🟢 Approval recommended
Only a minor regression-test suggestion remains; no blocking issues were identified.
Pull request overview
Optimizes RSS widget rendering by caching options once per output call instead of once per item.
Changes:
- Caches
blog_charsetonce. - Caches
date_formatwhen dates are enabled.
File summaries
| File | Summary |
|---|---|
src/wp-includes/widgets.php |
Reduces repeated option lookups during RSS rendering. |
Review details
Suppressed comments (1)
src/wp-includes/widgets.php:1641
- This change is specifically about the number and timing of
get_option()calls, but there is no regression test for that behavior. Please add a test with multiple RSS items that countsblog_charsetanddate_formatoption retrievals, including theshow_date-disabled path, so the optimization cannot silently regress to per-item calls.
$blog_charset = get_option( 'blog_charset' );
$date_format = $show_date ? get_option( 'date_format' ) : '';
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Trac ticket: https://core.trac.wordpress.org/ticket/66132
Use of AI Tools
N/A
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.