Skip to content

Commit c7cd04c

Browse files
committed
General: Stop direct loading of files in /wp-admin that should only be included.
This changeset restricts direct access call in `/wp-admin` and its sub directories. Follow-up to [11768]. Props deepakrohilla. See #61314. git-svn-id: https://develop.svn.wordpress.org/trunk@59678 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 0f2334d commit c7cd04c

File tree

9 files changed

+45
-0
lines changed

9 files changed

+45
-0
lines changed

src/wp-admin/admin-functions.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
* @subpackage Administration
1010
*/
1111

12+
// Don't load directly.
13+
if ( ! defined( 'ABSPATH' ) ) {
14+
die( '-1' );
15+
}
16+
1217
_deprecated_file( basename( __FILE__ ), '2.5.0', 'wp-admin/includes/admin.php' );
1318

1419
/** WordPress Administration API: Includes all Administration functions. */

src/wp-admin/admin-header.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
* @subpackage Administration
77
*/
88

9+
// Don't load directly.
10+
if ( ! defined( 'ABSPATH' ) ) {
11+
die( '-1' );
12+
}
13+
914
header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
1015
if ( ! defined( 'WP_ADMIN' ) ) {
1116
require_once __DIR__ . '/admin.php';

src/wp-admin/custom-background.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
* @subpackage Administration
1010
*/
1111

12+
// Don't load directly.
13+
if ( ! defined( 'ABSPATH' ) ) {
14+
die( '-1' );
15+
}
16+
1217
_deprecated_file( basename( __FILE__ ), '5.3.0', 'wp-admin/includes/class-custom-background.php' );
1318

1419
/** Custom_Background class */

src/wp-admin/custom-header.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
* @subpackage Administration
1010
*/
1111

12+
// Don't load directly.
13+
if ( ! defined( 'ABSPATH' ) ) {
14+
die( '-1' );
15+
}
16+
1217
_deprecated_file( basename( __FILE__ ), '5.3.0', 'wp-admin/includes/class-custom-image-header.php' );
1318

1419
/** Custom_Image_Header class */

src/wp-admin/menu-header.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
* @subpackage Administration
77
*/
88

9+
// Don't load directly.
10+
if ( ! defined( 'ABSPATH' ) ) {
11+
die( '-1' );
12+
}
13+
914
/**
1015
* The current page.
1116
*

src/wp-admin/menu.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
* @subpackage Administration
77
*/
88

9+
// Don't load directly.
10+
if ( ! defined( 'ABSPATH' ) ) {
11+
die( '-1' );
12+
}
13+
914
/**
1015
* Constructs the admin menu.
1116
*

src/wp-admin/network/menu.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
* @since 3.1.0
88
*/
99

10+
// Don't load directly.
11+
if ( ! defined( 'ABSPATH' ) ) {
12+
die( '-1' );
13+
}
14+
1015
/* translators: Network menu item. */
1116
$menu[2] = array( __( 'Dashboard' ), 'manage_network', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'dashicons-dashboard' );
1217

src/wp-admin/options-head.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
* @subpackage Administration
99
*/
1010

11+
// Don't load directly.
12+
if ( ! defined( 'ABSPATH' ) ) {
13+
die( '-1' );
14+
}
15+
1116
$action = ! empty( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : '';
1217

1318
if ( isset( $_GET['updated'] ) && isset( $_GET['page'] ) ) {

src/wp-admin/user/menu.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
* @since 3.1.0
88
*/
99

10+
// Don't load directly.
11+
if ( ! defined( 'ABSPATH' ) ) {
12+
die( '-1' );
13+
}
14+
1015
$menu[2] = array( __( 'Dashboard' ), 'exist', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'dashicons-dashboard' );
1116

1217
$menu[4] = array( '', 'exist', 'separator1', '', 'wp-menu-separator' );

0 commit comments

Comments
 (0)