Skip to content

Fix all ABSPATH direct access errors #8932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
* @since 4.9.6
*/

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}

if ( ! class_exists( 'WP_Privacy_Requests_Table' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-privacy-requests-table.php';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
* @since 4.9.6
*/

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}

if ( ! class_exists( 'WP_Privacy_Requests_Table' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-privacy-requests-table.php';
}
Expand Down
5 changes: 5 additions & 0 deletions src/wp-admin/includes/class-wp-upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
* @since 2.8.0
*/

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}

/** WP_Upgrader_Skin class */
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader-skin.php';

Expand Down
5 changes: 5 additions & 0 deletions src/wp-admin/includes/nav-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
* @since 3.0.0
*/

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}

/** Walker_Nav_Menu_Edit class */
require_once ABSPATH . 'wp-admin/includes/class-walker-nav-menu-edit.php';

Expand Down
5 changes: 5 additions & 0 deletions src/wp-admin/includes/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
* @subpackage Administration
*/

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}

/** Walker_Category_Checklist class */
require_once ABSPATH . 'wp-admin/includes/class-walker-category-checklist.php';

Expand Down
5 changes: 5 additions & 0 deletions src/wp-includes/Requests/library/Requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@
* @since 6.2.0
*/

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}

include_once ABSPATH . WPINC . '/class-requests.php';
6 changes: 6 additions & 0 deletions src/wp-includes/blocks/require-dynamic-blocks.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<?php

// This file was autogenerated by tools/release/sync-stable-blocks.js, do not change manually!

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}

// Requires files for dynamic blocks necessary for core blocks registration.
require_once ABSPATH . WPINC . '/blocks/archives.php';
require_once ABSPATH . WPINC . '/blocks/avatar.php';
Expand Down
5 changes: 5 additions & 0 deletions src/wp-includes/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
* @subpackage Cache
*/

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}

/** WP_Object_Cache class */
require_once ABSPATH . WPINC . '/class-wp-object-cache.php';

Expand Down
5 changes: 5 additions & 0 deletions src/wp-includes/class-simplepie.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
return;
}

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}

// Load and register the SimplePie native autoloaders.
require ABSPATH . WPINC . '/SimplePie/autoloader.php';

Expand Down
5 changes: 5 additions & 0 deletions src/wp-includes/class-wp-customize-section.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
* @since 3.4.0
*/

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}

/**
* Customize Section class.
*
Expand Down
5 changes: 5 additions & 0 deletions src/wp-includes/meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
* @subpackage Meta
*/

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}

require ABSPATH . WPINC . '/class-wp-metadata-lazyloader.php';

/**
Expand Down
5 changes: 5 additions & 0 deletions src/wp-includes/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
* @package WordPress
*/

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}

/** WordPress Dependency Class */
require ABSPATH . WPINC . '/class-wp-dependency.php';

Expand Down
5 changes: 5 additions & 0 deletions src/wp-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
* @package WordPress
*/

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}

/**
* Stores the location of the WordPress directory of functions, classes, and core content.
*
Expand Down
7 changes: 7 additions & 0 deletions tools/release/sync-stable-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function main() {
`<?php

${ toolWarningMessage }

// Returns folder names for static blocks necessary for core blocks registration.
return array(
${ staticBlockFolderNames }
Expand All @@ -58,6 +59,12 @@ ${ staticBlockFolderNames }
`<?php

${ toolWarningMessage }

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
exit();
}

// Requires files for dynamic blocks necessary for core blocks registration.
${ dynamicBlockFileRequires }
`,
Expand Down
Loading