diff --git c/src/wp-admin/includes/class-wp-automatic-updater.php w/src/wp-admin/includes/class-wp-automatic-updater.php
index ea2d70c..3922a0b 100644
|
c
|
w
|
class WP_Automatic_Updater { |
| 31 | 31 | */ |
| 32 | 32 | public function is_disabled() { |
| 33 | 33 | // Background updates are disabled if you don't want file changes. |
| 34 | | if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) |
| | 34 | if ( wp_disallow_file_mods( 'automatic_updater' ) ) |
| 35 | 35 | return true; |
| 36 | 36 | |
| 37 | 37 | if ( wp_installing() ) |
diff --git c/src/wp-admin/includes/dashboard.php w/src/wp-admin/includes/dashboard.php
index aab5976..906b410 100644
|
c
|
w
|
function wp_dashboard_primary() { |
| 1149 | 1149 | ) |
| 1150 | 1150 | ); |
| 1151 | 1151 | |
| 1152 | | if ( ( ! defined( 'DISALLOW_FILE_MODS' ) || ! DISALLOW_FILE_MODS ) && ( ! is_multisite() && is_blog_admin() && current_user_can( 'install_plugins' ) ) || ( is_network_admin() && current_user_can( 'manage_network_plugins' ) && current_user_can( 'install_plugins' ) ) ) { |
| | 1152 | if ( ( ! wp_disallow_file_mods( 'dashboard_widget' ) ) && ( ! is_multisite() && is_blog_admin() && current_user_can( 'install_plugins' ) ) || ( is_network_admin() && current_user_can( 'manage_network_plugins' ) && current_user_can( 'install_plugins' ) ) ) { |
| 1153 | 1153 | $feeds['plugins'] = array( |
| 1154 | 1154 | 'link' => '', |
| 1155 | 1155 | 'url' => array( |
diff --git c/src/wp-admin/includes/translation-install.php w/src/wp-admin/includes/translation-install.php
index ee8254d..c9e942e 100644
|
c
|
w
|
function wp_download_language_pack( $download ) { |
| 181 | 181 | return $download; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | | if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) { |
| | 184 | if ( wp_disallow_file_mods( 'download_language_pack' ) ) { |
| 185 | 185 | return false; |
| 186 | 186 | } |
| 187 | 187 | |
| … |
… |
function wp_download_language_pack( $download ) { |
| 224 | 224 | * @return bool Returns true on success, false on failure. |
| 225 | 225 | */ |
| 226 | 226 | function wp_can_install_language_pack() { |
| 227 | | if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) { |
| | 227 | if ( wp_disallow_file_mods( 'can_install_language_pack' ) ) { |
| 228 | 228 | return false; |
| 229 | 229 | } |
| 230 | 230 | |
diff --git c/src/wp-includes/capabilities.php w/src/wp-includes/capabilities.php
index fe87bc8..92e6311 100644
|
c
|
w
|
function map_meta_cap( $cap, $user_id ) { |
| 336 | 336 | // Disallow the file editors. |
| 337 | 337 | if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) |
| 338 | 338 | $caps[] = 'do_not_allow'; |
| 339 | | elseif ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) |
| | 339 | elseif ( wp_disallow_file_mods( 'capability_edit_themes' ) ) |
| 340 | 340 | $caps[] = 'do_not_allow'; |
| 341 | 341 | elseif ( is_multisite() && ! is_super_admin( $user_id ) ) |
| 342 | 342 | $caps[] = 'do_not_allow'; |
| … |
… |
function map_meta_cap( $cap, $user_id ) { |
| 354 | 354 | case 'update_core': |
| 355 | 355 | // Disallow anything that creates, deletes, or updates core, plugin, or theme files. |
| 356 | 356 | // Files in uploads are excepted. |
| 357 | | if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) { |
| | 357 | if ( wp_disallow_file_mods( 'capability_update_core' ) ) { |
| 358 | 358 | $caps[] = 'do_not_allow'; |
| 359 | 359 | } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { |
| 360 | 360 | $caps[] = 'do_not_allow'; |
diff --git c/src/wp-includes/load.php w/src/wp-includes/load.php
index 42e2b71..5eff9c9 100644
|
c
|
w
|
function wp_doing_ajax() { |
| 1064 | 1064 | function is_wp_error( $thing ) { |
| 1065 | 1065 | return ( $thing instanceof WP_Error ); |
| 1066 | 1066 | } |
| | 1067 | |
| | 1068 | /** |
| | 1069 | * Determines whether file modifications are disallowed. |
| | 1070 | * |
| | 1071 | * @since 4.7.0 |
| | 1072 | * |
| | 1073 | * @param string $context Where it has been called from. |
| | 1074 | * @return bool True if file modification is disallowed, False otherwise. |
| | 1075 | */ |
| | 1076 | function wp_disallow_file_mods( $context ) { |
| | 1077 | /** |
| | 1078 | * Filter the DISALLOW_FILE_MODS constant. |
| | 1079 | * |
| | 1080 | * @since 4.7.0 |
| | 1081 | * |
| | 1082 | * @param bool $disllow_file_mods The DISALLOW_FILE_MODS value. |
| | 1083 | * @param string $context Where it has been called from. |
| | 1084 | */ |
| | 1085 | return apply_filters( 'disallow_file_mods' , defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS, $context ); |
| | 1086 | } |