Title: WP_Site_Health::get_test_autoloaded_options
Published: July 16, 2024
Last modified: August 20, 2026

---

# WP_Site_Health::get_test_autoloaded_options(): array

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_site_health/get_test_autoloaded_options/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_site_health/get_test_autoloaded_options/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/classes/wp_site_health/get_test_autoloaded_options/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/classes/wp_site_health/get_test_autoloaded_options/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_site_health/get_test_autoloaded_options/?output_format=md#changelog)

Tests the number of autoloaded options.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_site_health/get_test_autoloaded_options/?output_format=md#return)󠁿

 array The test results.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_site_health/get_test_autoloaded_options/?output_format=md#source)󠁿

    ```php
    public function get_test_autoloaded_options() {
    	$autoloaded_options_size  = $this->get_autoloaded_options_size();
    	$autoloaded_options_count = count( wp_load_alloptions() );

    	$base_description = __( 'Autoloaded options are configuration settings for plugins and themes that are automatically loaded with every page load in WordPress. Having too many autoloaded options can slow down your site.' );

    	$result = array(
    		'label'       => __( 'Autoloaded options are acceptable' ),
    		'status'      => 'good',
    		'badge'       => array(
    			'label' => __( 'Performance' ),
    			'color' => 'blue',
    		),
    		'description' => sprintf(
    			/* translators: 1: Number of autoloaded options, 2: Autoloaded options size. */
    			'<p>' . esc_html( $base_description ) . ' ' . __( 'Your site has %1$s autoloaded options (size: %2$s) in the options table, which is acceptable.' ) . '</p>',
    			$autoloaded_options_count,
    			size_format( $autoloaded_options_size )
    		),
    		'actions'     => '',
    		'test'        => 'autoloaded_options',
    	);

    	/**
    	 * Filters max bytes threshold to trigger warning in Site Health.
    	 *
    	 * @since 6.6.0
    	 *
    	 * @param int $limit Autoloaded options threshold size. Default 800000.
    	 */
    	$limit = apply_filters( 'site_status_autoloaded_options_size_limit', 800000 );

    	if ( $autoloaded_options_size < $limit ) {
    		return $result;
    	}

    	$result['status']      = 'critical';
    	$result['label']       = __( 'Autoloaded options could affect performance' );
    	$result['description'] = sprintf(
    		/* translators: 1: Number of autoloaded options, 2: Autoloaded options size. */
    		'<p>' . esc_html( $base_description ) . ' ' . __( 'Your site has %1$s autoloaded options (size: %2$s) in the options table, which could cause your site to be slow. You can review the options being autoloaded in your database and remove any options that are no longer needed by your site.' ) . '</p>',
    		$autoloaded_options_count,
    		size_format( $autoloaded_options_size )
    	);

    	/**
    	 * Filters description to be shown on Site Health warning when threshold is met.
    	 *
    	 * @since 6.6.0
    	 *
    	 * @param string $description Description message when autoloaded options bigger than threshold.
    	 */
    	$result['description'] = apply_filters( 'site_status_autoloaded_options_limit_description', $result['description'] );

    	$result['actions'] = sprintf(
    		/* translators: 1: HelpHub URL, 2: Link description. */
    		'<p><a target="_blank" href="%1$s">%2$s</a></p>',
    		esc_url( __( 'https://developer.wordpress.org/advanced-administration/performance/optimization/#autoloaded-options' ) ),
    		__( 'More info about optimizing autoloaded options' )
    	);

    	/**
    	 * Filters actionable information to tackle the problem. It can be a link to an external guide.
    	 *
    	 * @since 6.6.0
    	 *
    	 * @param string $actions Call to Action to be used to point to the right direction to solve the issue.
    	 */
    	$result['actions'] = apply_filters( 'site_status_autoloaded_options_action_to_perform', $result['actions'] );
    	return $result;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/class-wp-site-health.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-admin/includes/class-wp-site-health.php#L2679)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-admin/includes/class-wp-site-health.php#L2679-L2749)

## 󠀁[Hooks](https://developer.wordpress.org/reference/classes/wp_site_health/get_test_autoloaded_options/?output_format=md#hooks)󠁿

 [apply_filters( ‘site_status_autoloaded_options_action_to_perform’, string $actions )](https://developer.wordpress.org/reference/hooks/site_status_autoloaded_options_action_to_perform/)

Filters actionable information to tackle the problem. It can be a link to an external
guide.

 [apply_filters( ‘site_status_autoloaded_options_limit_description’, string $description )](https://developer.wordpress.org/reference/hooks/site_status_autoloaded_options_limit_description/)

Filters description to be shown on Site Health warning when threshold is met.

 [apply_filters( ‘site_status_autoloaded_options_size_limit’, int $limit )](https://developer.wordpress.org/reference/hooks/site_status_autoloaded_options_size_limit/)

Filters max bytes threshold to trigger warning in Site Health.

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_site_health/get_test_autoloaded_options/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Site_Health::get_autoloaded_options_size()](https://developer.wordpress.org/reference/classes/wp_site_health/get_autoloaded_options_size/)`wp-admin/includes/class-wp-site-health.php` |

Calculates total amount of autoloaded data.

  | 
| [size_format()](https://developer.wordpress.org/reference/functions/size_format/)`wp-includes/functions.php` |

Converts a number of bytes to the largest unit the bytes will fit into.

  | 
| [wp_load_alloptions()](https://developer.wordpress.org/reference/functions/wp_load_alloptions/)`wp-includes/option.php` |

Loads and caches all autoloaded options, if available or all options.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [esc_html()](https://developer.wordpress.org/reference/functions/esc_html/)`wp-includes/formatting.php` |

Escaping for HTML blocks.

  | 
| [esc_url()](https://developer.wordpress.org/reference/functions/esc_url/)`wp-includes/formatting.php` |

Checks and cleans a URL.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

[Show 4 more](https://developer.wordpress.org/reference/classes/wp_site_health/get_test_autoloaded_options/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_site_health/get_test_autoloaded_options/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_site_health/get_test_autoloaded_options/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.6.0](https://developer.wordpress.org/reference/since/6.6.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_site_health%2Fget_test_autoloaded_options%2F)
before being able to contribute a note or feedback.