Make WordPress Core

Opened 9 years ago

Closed 8 years ago

#28402 closed enhancement (fixed)

Pass option name to pre_option_OPTION and pre_update_option_OPTION filters

Reported by: viper007bond's profile Viper007Bond Owned by: drewapicture's profile DrewAPicture
Milestone: 4.4 Priority: lowest
Severity: trivial Version: 3.9.1
Component: Options, Meta APIs Keywords: needs-patch needs-docs
Focuses: Cc:

Description

If you want to hook a common callback function onto multiple pre_option_OPTION or pre_update_option_OPTION filters, you have to parse current_filter() to get what option is currently being modified. Instead we could just pass $option as another parameter.

Attachments (5)

28402.patch (1.0 KB) - added by Viper007Bond 9 years ago.
28402.2.patch (11.0 KB) - added by SergeyBiryukov 9 years ago.
28402.3.diff (24.2 KB) - added by MikeHansenMe 9 years ago.
Refresh based on Sergey's patch and tried to make code sniffer happy
28402.4.diff (24.3 KB) - added by MikeHansenMe 8 years ago.
28402.diff (11.0 KB) - added by wonderboymusic 8 years ago.

Download all attachments as: .zip

Change History (31)

@Viper007Bond
9 years ago

#1 @Viper007Bond
9 years ago

Hmm, PhpStorm injected some stuff into the top of the patch file. Sorry about that.

#2 @SergeyBiryukov
9 years ago

28402.2.patch is a (probably overzealous) attempt to do this for other option filters.

@MikeHansenMe
9 years ago

Refresh based on Sergey's patch and tried to make code sniffer happy

@MikeHansenMe
8 years ago

#3 @MikeHansenMe
8 years ago

28402.4.diff is a refresh of .3.diff since it would not apply cleanly.

#4 @SergeyBiryukov
8 years ago

  • Milestone changed from Awaiting Review to 4.4

@wonderboymusic
8 years ago

#5 @wonderboymusic
8 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 33738:

Pass option name to option and transient filters with dynamic names.

Props Viper007Bond, SergeyBiryukov, MikeHansenMe.
Fixes #28402.

#6 @SergeyBiryukov
8 years ago

  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

I guess we'll need @since 4.4.0 Added ... parameter. docs for each hook.

#7 @DrewAPicture
8 years ago

  • Keywords needs-docs added

#8 @DrewAPicture
8 years ago

In 33768:

Docs: Add a changelog entry to the pre_option_$option hook doc for the $option parameter, added in [33738].

See #28402

#9 @wonderboymusic
8 years ago

  • Owner changed from wonderboymusic to DrewAPicture
  • Status changed from reopened to assigned

#10 @DrewAPicture
8 years ago

In 33778:

Docs: Add a changelog entry to the default_option_$option hook doc for the $option parameter, added in [33738].

See #28402

#11 @DrewAPicture
8 years ago

In 33779:

Docs: Add a changelog entry to the option_$option hook doc for the $option parameter, added in [33738].

See #28402.

#12 @DrewAPicture
8 years ago

In 33780:

Docs: Add a changelog entry to the pre_update_option_$option hook doc for the $option parameter, added in [33738].

See #28402.

#13 @DrewAPicture
8 years ago

In 33781:

Docs: Add a changelog entry to the update_option_{$option} hook doc for the $option parameter, introduced in [33738].

See #28402.

#14 @DrewAPicture
8 years ago

In 33782:

Docs: Add a changelog entry to the pre_transient_$transient hook doc for the $transient parameter, introduced in [33738].

See #28402.

#15 @DrewAPicture
8 years ago

In 33783:

Docs: Add a changelog entry to the transient_$transient hook doc for the $transient parameter, introduced in [33738].

See #28402.

#16 @DrewAPicture
8 years ago

In 33784:

Docs: Add a changelog entry to the pre_set_transient_$transient hook doc for the $transient parameter, added in [33738].

See #28402.

#17 @DrewAPicture
8 years ago

In 33785:

Docs: Add a changelog entry to the pre_site_option_$option hook doc for the $option parameter, added in [33738].

See #28402.

#18 @DrewAPicture
8 years ago

In 33786:

Docs: Add a changelog entry to the default_site_option_$option hook doc for the $option parameter, added in [33738].

See #28402.

#19 @DrewAPicture
8 years ago

In 33787:

Docs: Add a changelog entry to the site_option_$option hook doc for the $option parameter, added in [33738].

See #28402.

#20 @DrewAPicture
8 years ago

In 33788:

Docs: Add a changelog entry to the pre_add_site_option_$option hook doc for the $option parameter, added in [33738].

See #28402.

#21 @DrewAPicture
8 years ago

In 33789:

Docs: Add a changelog entry to the pre_delete_site_option_$option hook doc for the $option parameter, added in [33738].

See #28402.

#22 @DrewAPicture
8 years ago

In 33790:

Docs: Add a changelog entry to the pre_update_site_option_$option hook doc for the $option parameter, added in [33738].

See #28402.

#23 @DrewAPicture
8 years ago

In 33791:

Docs: Add a changelog entry to the pre_site_transient_$transient hook doc for the $transient parameter, added in [33738].

See #28402.

#24 @DrewAPicture
8 years ago

In 33792:

Docs: Add a changelog entry to the site_transient_$transient hook doc for the $transient parameter, added in [33738].

See #28402.

#25 @DrewAPicture
8 years ago

In 33793:

Docs: Add a changelog entry to the pre_set_site_transient_$transient hook doc for the $transient parameter, added in [33738].

See #28402.

#26 @DrewAPicture
8 years ago

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

In 33794:

Docs: Add a changelog entry to the set_site_transient_$transient hook doc for the $transient parameter, added in [33738].

Fixes #28402.

Note: See TracTickets for help on using tickets.