abspath() ); } public static function content(): string { return self::normalize( self::filesystem()->wp_content_dir() ); } public static function plugins(): string { return self::normalize( self::filesystem()->wp_plugins_dir() ); } public static function mustUse(): string { // WordPress has no directory-returning API for this separately relocatable root. // The documented configuration constant is required even when the folder is empty; // deriving it from content/plugins or an installed MU file would miss scan scope. return defined( 'WPMU_PLUGIN_DIR' ) ? self::normalize( WPMU_PLUGIN_DIR ) : ''; } public static function roots(): array { return array_filter( array( self::wordpress(), self::content(), self::plugins(), self::mustUse() ) ); } public static function themes(): array { $roots = array(); $default = get_theme_root(); if ( is_string( $default ) && '' !== $default ) { $roots[] = untrailingslashit( wp_normalize_path( $default ) ); } $themes = search_theme_directories(); foreach ( is_array( $themes ) ? $themes : array() as $theme ) { if ( is_array( $theme ) && is_string( $theme['theme_root'] ?? null ) && '' !== $theme['theme_root'] ) { $roots[] = untrailingslashit( wp_normalize_path( $theme['theme_root'] ) ); } } return array_values( array_unique( $roots ) ); } }