Skip to content

Conversation

@b1ink0
Copy link
Contributor

@b1ink0 b1ink0 commented Nov 11, 2025

Summary

Fixes #2238

Relevant technical choices

  • Adds tag optimization-detective to Image Prioritizer and Embed Optimizer readme.txt
  • Adds plugin meta link directing users to plugin directory to discover extensions that provide optimization functionality using the Optimization Detective plugin.
  • Adds admin notice when Optimization Detective has no installed extensions
image

Demo:

Demo.2.mp4

Gemini Review

The latest updates further refine the extension detection and UI. The changes are logical, robust, and well-tested.

Summary of Changes

The PR improves the user experience for the Optimization Detective framework by guiding users toward installing and activating optimization extensions.

  • Plugin Discovery: Adds an "Extensions" meta link to the Optimization Detective plugin row, directing users to the plugin directory filtered by the optimization-detective tag.
  • Active Extension Detection: Implements od_get_active_extensions() which identifies active optimization plugins by checking the RequiresPlugins header (with a fallback for embed-optimizer). The list is now returned as unique values (array_values( array_unique( ... ) )).
  • Admin Guidance: Introduces an informative admin notice (using <details> for a compact UI) that appears on the plugins page when no extensions are active.
    • Prompts users to install "Image Prioritizer" or "Embed Optimizer".
    • Now conditionally renders the install/details link based on the user's install_plugins capability. If they cannot install plugins, it just shows the name.
    • Uses add_thickbox() only if the user has permission to install plugins.
  • Documentation Access: Adds direct links to the project's GitHub documentation (Introduction, Hooks, Extensions) within the plugin row.
  • Testing: Includes thorough PHPUnit tests covering the new helper functions, meta links, and admin notice logic.

Review Notes

  • Coding Standards: The code adheres to WordPress core coding standards. All functions are properly documented with @since n.e.x.t and use appropriate type hints.
  • Compatibility: The changes are compatible with PHP 7.2+.
  • Performance: The extension detection logic is hooked to after_plugin_row_meta, ensuring it only runs on the plugins admin screen where the impact is minimal. The use of get_plugins() is cached by WordPress.
  • Robustness:
    • The use of wp_kses and esc_url ensures all rendered HTML in the admin notices and links is secure.
    • The capability checks for install_plugins are a nice touch for multi-user environments.
  • Verified: All 351 tests for Optimization Detective passed successfully.

Review generated by Gemini CLI.

@b1ink0 b1ink0 added [Type] Enhancement A suggestion for improvement of an existing feature [Plugin] Optimization Detective Issues for the Optimization Detective plugin labels Nov 11, 2025
@codecov
Copy link

codecov bot commented Nov 11, 2025

Codecov Report

❌ Patch coverage is 98.71795% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 69.17%. Comparing base (6837f4a) to head (627f960).
⚠️ Report is 41 commits behind head on trunk.

Files with missing lines Patch % Lines
plugins/optimization-detective/helper.php 98.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #2261      +/-   ##
==========================================
+ Coverage   68.87%   69.17%   +0.30%     
==========================================
  Files          90       90              
  Lines        7618     7696      +78     
==========================================
+ Hits         5247     5324      +77     
- Misses       2371     2372       +1     
Flag Coverage Δ
multisite 69.17% <98.71%> (+0.30%) ⬆️
single 35.35% <29.48%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@westonruter
Copy link
Member

@b1ink0 This is marked as a draft. Is it ready for review?

@b1ink0
Copy link
Contributor Author

b1ink0 commented Jan 6, 2026

@westonruter, I’ve added my doubts in the comments above. I was planning to mark this for review after those are clarified.

#2261 (comment)

#2261 (comment)

@b1ink0 b1ink0 marked this pull request as ready for review January 7, 2026 07:24
@github-actions
Copy link

github-actions bot commented Jan 7, 2026

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: b1ink0 <[email protected]>
Co-authored-by: westonruter <[email protected]>
Co-authored-by: adamsilverstein <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

westonruter and others added 5 commits January 7, 2026 13:31
Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@b1ink0 Thank you! This will be very helpful for users.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@westonruter
Copy link
Member

westonruter commented Jan 7, 2026

Oh, I just tried adding to my wp-config.php:

define( 'DISALLOW_FILE_MODS', true );

And when clicking on one of the links to open the modal, I get an error:

image

So it seems we will need to add some special accommodation here. What I've done is 8be1e47, to simply omit the links and prevent calling add_thickbox():

With DISALLOW_FILE_MODS Without DISALLOW_FILE_MODS
image image

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@westonruter westonruter merged commit 11d0f73 into WordPress:trunk Jan 7, 2026
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Enhancement A suggestion for improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make it clear that Optimization Detective installed by itself does nothing and provide next steps

2 participants