WordPress.org

Make WordPress Core

Ticket #47002: 47002.patch

File 47002.patch, 4.9 KB (added by mehrshaddarzi, 7 months ago)
  • wp-includes/default-constants.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    204204        }
    205205}
    206206
     207/**
     208 * Defines theme directory WordPress constants
     209 *
     210 * @since 5.3.0
     211 */
     212function wp_theme_directory_constants() {
     213        /**
     214         * Allows for the define custom themes directory name.
     215         *
     216         * @since 5.3.0
     217         */
     218        if ( ! defined( 'WP_THEMES_DIR' ) ) {
     219                define( 'WP_THEMES_DIR', 'themes' );
     220        }
     221
     222        /**
     223         * Allows for the define custom themes directory location.
     224         *
     225         * @since 5.3.0
     226         */
     227        if ( ! defined( 'WP_THEMES_PATH' ) ) {
     228                define( 'WP_THEMES_PATH', WP_CONTENT_DIR . '/' . WP_THEMES_DIR ); // full path of WordPress themes directory
     229        }
     230
     231        /**
     232         * Allows for the themes directory to be change default url.
     233         *
     234         * @since 5.3.0
     235         */
     236        if ( ! defined( 'WP_THEMES_URL' ) ) {
     237                define( 'WP_THEMES_URL', content_url( WP_THEMES_DIR ) ); // full url, no trailing slash
     238        }
     239}
     240
    207241/**
    208242 * Defines cookie related WordPress constants
    209243 *
  • wp-admin/includes/class-wp-filesystem-base.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    9595                $theme_root = get_theme_root( $theme );
    9696
    9797                // Account for relative theme roots
    98                 if ( '/themes' == $theme_root || ! is_dir( $theme_root ) ) {
     98                if ( '/' . WP_THEMES_DIR == $theme_root || ! is_dir( $theme_root ) ) {
    9999                        $theme_root = WP_CONTENT_DIR . $theme_root;
    100100                }
    101101
  • wp-settings.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    333333
    334334wp_start_scraping_edited_file_errors();
    335335
     336// Define WordPress themes constants.
     337wp_theme_directory_constants();
     338
    336339// Register the default theme directory root
    337340register_theme_directory( get_theme_root() );
    338341
  • wp-admin/includes/class-wp-upgrader.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    533533                 * to copy the directory into the directory, whilst they pass the source
    534534                 * as the actual files to copy.
    535535                 */
    536                 $protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes' );
     536                $protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_THEMES_PATH );
    537537
    538538                if ( is_array( $wp_theme_directories ) ) {
    539539                        $protected_directories = array_merge( $protected_directories, $wp_theme_directories );
  • wp-includes/theme.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    370370function get_theme_roots() {
    371371        global $wp_theme_directories;
    372372
    373         if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) {
    374                 return '/themes';
     373        if ( ! is_array( $wp_theme_directories ) || ( count( $wp_theme_directories ) == 1 and $wp_theme_directories[0] == WP_THEMES_PATH and WP_THEMES_DIR == 'themes' ) ) {
     374                return '/'. WP_THEMES_DIR;
    375375        }
    376376
    377377        $theme_roots = get_site_transient( 'theme_roots' );
     
    577577                        $theme_root = WP_CONTENT_DIR . $theme_root;
    578578                }
    579579        } else {
    580                 $theme_root = WP_CONTENT_DIR . '/themes';
     580                $theme_root = WP_CONTENT_DIR . '/' . WP_THEMES_DIR;
     581                if ( $theme_root != WP_THEMES_PATH ) {
     582                        $theme_root = WP_THEMES_PATH;
     583                }
    581584        }
    582585
    583586        /**
     
    628631                        $theme_root_uri = content_url( $theme_root );
    629632                }
    630633        } else {
    631                 $theme_root_uri = content_url( 'themes' );
     634                $theme_root_uri = content_url( WP_THEMES_DIR );
     635        }
     636
     637        /**
     638         * Check if defined new WordPress themes directory constant.
     639         *
     640         * @since 5.3.0
     641         */
     642        if ( content_url( 'themes' ) != WP_THEMES_URL ) {
     643                $theme_root_uri = WP_THEMES_URL;
    632644        }
    633645
    634646        /**
     
    658670function get_raw_theme_root( $stylesheet_or_template, $skip_cache = false ) {
    659671        global $wp_theme_directories;
    660672
    661         if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) {
    662                 return '/themes';
     673        if ( ! is_array( $wp_theme_directories ) || ( count( $wp_theme_directories ) == 1 and $wp_theme_directories[0] == WP_THEMES_PATH and WP_THEMES_DIR == 'themes' ) ) {
     674            return '/'. WP_THEMES_DIR;
    663675        }
    664676
    665677        $theme_root = false;