WordPress.org

Make WordPress Core

Opened 4 hours ago

Last modified 11 minutes ago

#49599 new defect (bug)

Wrong PHPDoc wp_get_active_and_valid_plugins

Reported by: herrvigg Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.3.2
Component: Plugins Keywords:
Focuses: docs Cc:

Description

I found a misleading error in the documentation of wp_get_active_and_valid_plugins (in wp-includes/load.php):

<?php
* @return string[] $plugin_file Array of paths to plugin files relative to the plugins directory.
*/ 
function wp_get_active_and_valid_plugins() {

This is wrong, the plugin files are returned as absolute path - not relative. The files are returned as follows:

<?php
$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;

This is not very consistent with the rest of the API working rather with relative paths, but changing the code would break many plugins for sure. The documentation should be updated.

Change History (1)

#1 @sebastienserre
11 minutes ago

Hello,
I'm not sure but I think it did not say that it's a relative path but that the returned path is relative to the plugin path. With relative in sense of "concern"

Note: See TracTickets for help on using tickets.