Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#48357 closed defect (bug) (fixed)

Improve documentation for wp-includes/option.php

Reported by: leogermani's profile leogermani Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.4 Priority: normal
Severity: normal Version:
Component: Options, Meta APIs Keywords: good-first-bug has-patch
Focuses: docs Cc:

Description

In the update_option documentation, since the $autoload parameter is added, the sentence below is incorrect:

If the option does not exist, then the option will be added with the option value, with an $autoload value of 'yes'.

Actually it will be added with whatever was passed to the $autoload parameter, 'yes' being only the default value.

This ticket/patch proposes a new text for the function description and for the documentation of the $autoload argument.

Attachments (1)

48357.diff (1.8 KB) - added by leogermani 5 years ago.

Download all attachments as: .zip

Change History (7)

#1 @desrosj
5 years ago

  • Keywords good-first-bug needs-patch added
  • Milestone changed from Awaiting Review to 5.4

Thanks for this, @leogermani. Are you interested in creating a patch?

#2 @leogermani
5 years ago

  • Keywords has-patch added; needs-patch removed

Here it is:

https://github.com/leogermani/WordPress/pull/1

This is the first time I submit a patch with a pull request (I've heard it's possible). Do I need to do anything else?

Last edited 5 years ago by leogermani (previous) (diff)

@leogermani
5 years ago

#3 @leogermani
5 years ago

Apparently I was wrong and I still need to manually upload the patch.

#4 @SergeyBiryukov
5 years ago

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

#5 @SergeyBiryukov
5 years ago

The current $autoload parameter description seems clear enough:

For existing options, $autoload can only be updated using update_option() if $value is also changed. Accepts 'yes'|true to enable or 'no'|false to disable. For non-existent options, the default value is 'yes'. Default null.

Related: [31628], [31640].

Let's just remove the inaccurate statement about the 'yes' value for new options.

#6 @SergeyBiryukov
5 years ago

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

In 47373:

Docs: In update_option(), remove an inaccurate statement about the $autoload value for new options.

If the option does not exist, it will be created with whatever was passed to the $autoload parameter, 'yes' being only the default value.

Props leogermani.
Fixes #48357.

Note: See TracTickets for help on using tickets.