From b03466a79d697f6ce74d1675b5755f2c88157ceb Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 27 Jun 2022 10:18:44 +0000 Subject: [PATCH] General: Revert an earlier define of the `WPINC` constant in `src/index.php`. This avoids a `Constant WPINC already defined in src/wp-settings.php on line 16` PHP warning, which happens when running a WordPress install out of the `src` directory after `npm run build:dev`. Add a comment to clarify the check for built assets and the direct mention of `wp-includes`. Follow-up to [53518]. Props aristath. See #54233. git-svn-id: https://develop.svn.wordpress.org/trunk@53579 602fd350-edb4-49c9-b593-d223f7449a82 --- src/index.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/index.php b/src/index.php index 0714b3beda..e5e130d105 100644 --- a/src/index.php +++ b/src/index.php @@ -11,13 +11,16 @@ if ( ! defined( 'ABSPATH' ) ) { define( 'ABSPATH', __DIR__ . '/' ); } -define( 'WPINC', 'wp-includes' ); - -if ( file_exists( ABSPATH . WPINC . '/js/dist/edit-post.js' ) ) { +/* + * Load the actual index.php file if the assets were already built. + * Note: WPINC is not defined yet, it is defined later in wp-settings.php. + */ +if ( file_exists( ABSPATH . 'wp-includes/js/dist/edit-post.js' ) ) { require_once ABSPATH . '_index.php'; return; } +define( 'WPINC', 'wp-includes' ); require_once ABSPATH . WPINC . '/load.php'; // Standardize $_SERVER variables across setups.