#62888 closed defect (bug) (duplicate)
Plugin dependencies and "pro" version
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 6.7.1 |
Component: | HTTP API | Keywords: | |
Focuses: | administration, performance | Cc: |
Description
This post shows how to use wp_plugin_dependencies_slug. Now every plugin listing (/wp-admin/plugins.php) makes a request to https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Bslug%5D=my-plugin-pro&request%5Bfields%5D%5Bshort_description%5D=1&request%5Bfields%5D%5Bicons%5D=1&request%5Blocale%5D=de_DE&request%5Bwp_version%5D=6.7"
This request fails with 404 because the "my-plugin-pro" is not hosted by WordPress and is not necessary.
Change History (6)
#2
@
4 months ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
Duplicate of #61525.
#3
@
4 months ago
Just noting that per #61525, having my-plugin-pro
as the dependency is probably incorrect, and it should have a URI or other namespaced value instead of just a slug (Which refers to a w.org plugin)
#4
@
4 months ago
Thank you very much, it works now like the example. But this should documented somewhere.
* Requires Plugins: slug1, slug2, ||slug2-pro
#5
@
3 months ago
This should work for when there are both freemium and premium plugins.
add_filter( 'wp_plugin_dependencies_slug', function ($slug) { $slug = 'my-plugin' === $slug ? 'my-plugin-pro' : $slug; return $slug; }, 10, 1 );
#6
@
3 months ago
The code post ist correct. I learned that you have to define a filter for plugins_api to prevent the not necessary HTTP-API-Requests.
This sounds like #61525.