Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#61522 accepted enhancement

Add autoload control to register_setting()

Reported by: pbearne Owned by: pbearne
Priority: normal Milestone: Awaiting Review
Component: Options, Meta APIs Version:
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses: performance

Description (last modified by swissspidy)

There doesn't seem to be a way to declare a setting does not need to be autoloaded (or loaded just in admin)

lets add this option to register_setting()

Change History (4)

#1 @pbearne
2 years ago

  • Owner set to pbearne
  • Status assignedaccepted

#2 @swissspidy
2 years ago

  • Description modified (diff)
  • Summary allow control for if a setting should be autoloadedAdd autoload control to register_setting()

This ticket was mentioned in Slack in #core-performance by pbearne. View the logs.


2 years ago

This ticket was mentioned in PR #6994 on WordPress/wordpress-develop by @pbearne.


2 years ago
#4

  • Keywords has-patch has-unit-tests added

This commit introduces an autoload parameter in the register_setting function, allowing users to specify if a setting should be autoloaded. Autoloaded settings are loaded on every page, improving the performance for settings that are frequently used. The change includes both the addition of the autoload parameter in the registration function as well as the corresponding changes in the database layout to store this information. This also includes a modification to wp_default_autoload_value filter to reflect the new autoload state. Changes are carried out across multiple files like theme-options.php, option.php, featured-content.php etc., for proper implementation.

Note: See TracTickets for help on using tickets.