Filter hook 'wp_max_autoloaded_option_size'

in WP Core File wp-includes/option.php at line 1362

View Source

wp_max_autoloaded_option_size

Filter Hook
Description
Filters the maximum size of option value in bytes.

Hook Information

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

Hook Parameters

Type Name Description
int $max_option_size The option-size threshold, in bytes. Default 150000.
string $option The name of the option.

Usage Examples

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

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

Source Code Context

wp-includes/option.php:1362 - How this hook is used in WordPress core
<?php
1357  	 * @since 6.6.0
1358  	 *
1359  	 * @param int    $max_option_size The option-size threshold, in bytes. Default 150000.
1360  	 * @param string $option          The name of the option.
1361  	 */
1362  	$max_option_size = (int) apply_filters( 'wp_max_autoloaded_option_size', 150000, $option );
1363  	$size            = ! empty( $serialized_value ) ? strlen( $serialized_value ) : 0;
1364  
1365  	if ( $size > $max_option_size ) {
1366  		return false;
1367  	}

PHP Documentation

<?php
/**
	 * Filters the maximum size of option value in bytes.
	 *
	 * @since 6.6.0
	 *
	 * @param int    $max_option_size The option-size threshold, in bytes. Default 150000.
	 * @param string $option          The name of the option.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/option.php
Related Hooks

Related hooks will be displayed here in future updates.