Make WordPress Core

Opened 11 months ago

Closed 10 months ago

Last modified 10 months ago

#58963 closed task (blessed) (fixed)

Expand `$autoload` parameter documentation of `add_option()` and `update_option()`

Reported by: flixos90's profile flixos90 Owned by: flixos90's profile flixos90
Milestone: 6.4 Priority: normal
Severity: normal Version:
Component: Options, Meta APIs Keywords: has-patch
Focuses: docs, performance Cc:

Description

As outlined with more context in #42441 and #58962, "excessive autoloading" (i.e. autoloading too many options) can lead to performance problems, in some cases huge ones that even cause bugs.

Part of the problem is that there is very little documentation on option autoloading, which makes it challenging for the WordPress ecosystem to understand and properly use it. This also is reflected in extremely limiting, and possibly even misleading inline documentation of the $autoload parameter of add_option() and update_option().

This ticket aims to update said inline documentation to provide additional context on what the parameter does and how it should be used.

Change History (9)

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


11 months ago
#1

  • Keywords has-patch added; needs-patch removed

Improving inline doc for the add_option(), and update_option()

Trac ticket: https://core.trac.wordpress.org/ticket/58963

#2 @rajinsharwar
11 months ago

Let me know if anything is missed or overdone @flixos90. Thanks!

#3 @flixos90
11 months ago

  • Owner set to flixos90
  • Status changed from new to reviewing

Thank you for the pull request @rajinsharwar! I left some feedback.

Last edited 11 months ago by flixos90 (previous) (diff)

#4 @rajinsharwar
11 months ago

Hi @flixos90, updated the PR following your suggestion. Requesting a re-review.

@flixos90 commented on PR #4960:


10 months ago
#5

Thank you @Rajinsharwar for the updates! Note that there are a few coding standards violations flagged in GitHub, for example indentation of inline doc parameter descriptions needs to use spaces, not tabs. Would you mind fixing these violations?

#6 @rajinsharwar
10 months ago

Sure! Just fixed those coding standards issues, can you please take a look now? @flixos90

#7 @rajinsharwar
10 months ago

Updated the confusing line as well :) @flixos90

#8 @flixos90
10 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 56370:

Options, Meta APIs: Expand $autoload parameter documentation.

This changeset expands documentation of the $autoload parameter of the add_option() and update_option() functions, in order to provide more context on what autoloading is and which considerations should go into the decision whether to autoload an option.

Excessive autoloading of options can lead to severe performance problems on some sites, and lack of documentation is a partial cause for the issue.

Props rajinsharwar.
Fixes #58963.

Note: See TracTickets for help on using tickets.