codestar-framework icon indicating copy to clipboard operation
codestar-framework copied to clipboard

Incorrect utilization of WP_PLUGIN_DIR in CSF_Setup::constants

Open rfair404 opened this issue 1 year ago • 0 comments

The code that "detects" if the framework has been included in a plugin, or a theme doesn't properly detect the plugin path when WP's real path is different from the CONTENT_DIR_URL. Plugins should not use WP_PLUGIN_DIR.

At very minimum, the framework should provide a filter, which would allow a developer to over-ride this logic, or better, find a suitable manner of detecting if the file resides within a theme or a plug-in (and getting it's path) without simply comparing the path of the file to the plugins path.

a solution more like:

$plugin_dir     = str_replace( '//', '/', wp_normalize_path( plugin_dir_path( dirname( dirname( self::$file ) ) ) ) );

would be better suited.

rfair404 avatar Apr 01 '24 21:04 rfair404