Filter hook 'file_mod_allowed'

in WP Core File wp-includes/load.php at line 1832

View Source

file_mod_allowed

Filter Hook
Description
Filters whether file modifications are allowed.

Hook Information

File Location wp-includes/load.php View on GitHub
Hook Type Filter
Line Number 1832

Hook Parameters

Type Name Description
bool $file_mod_allowed Whether file modifications are allowed.
string $context The usage context.

Usage Examples

Basic Usage
<?php
// Hook into file_mod_allowed
add_filter('file_mod_allowed', 'my_custom_filter', 10, 2);

function my_custom_filter($file_mod_allowed, $context) {
    // Your custom filtering logic here
    return $file_mod_allowed;
}

Source Code Context

wp-includes/load.php:1832 - How this hook is used in WordPress core
<?php
1827  	 * @since 4.8.0
1828  	 *
1829  	 * @param bool   $file_mod_allowed Whether file modifications are allowed.
1830  	 * @param string $context          The usage context.
1831  	 */
1832  	return apply_filters( 'file_mod_allowed', ! defined( 'DISALLOW_FILE_MODS' ) || ! DISALLOW_FILE_MODS, $context );
1833  }
1834  
1835  /**
1836   * Starts scraping edited file errors.
1837   *

PHP Documentation

<?php
/**
	 * Filters whether file modifications are allowed.
	 *
	 * @since 4.8.0
	 *
	 * @param bool   $file_mod_allowed Whether file modifications are allowed.
	 * @param string $context          The usage context.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/load.php
Related Hooks

Related hooks will be displayed here in future updates.