Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#56045 closed enhancement (fixed)

Add filters to allow the shortcut return to wp_load_alloptions

Reported by: pbearne Owned by: spacedmonkey
Priority: normal Milestone: 6.2
Component: Options, Meta APIs Version:
Severity: normal Keywords: has-patch has-unit-tests commit needs-dev-note
Cc: Focuses: performance

Description (last modified by pbearne)

This adds a shortcut filter to the wp_load_options function

Change History (31)

#1 follow-up: @joyously
4 years ago

The Code Reference for get_option says

When one of the Options API filters is used: pre_option_$option, default_option_$option, or option_$option, the returned value may not match the expected type.

So, there are already filters. Exactly which functions need which filters?

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


4 years ago
#2

  • Keywords has-patch added

#3 @SergeyBiryukov
4 years ago

  • Milestone Awaiting Review
  • Resolutionduplicate
  • Status newclosed

Hi there, thanks for the ticket and the PR!

This looks like a duplicate of #37930.

#4 in reply to: ↑ 1 @pbearne
4 years ago

  • Description modified (diff)

Replying to joyously:

The Code Reference for get_option says

When one of the Options API filters is used: pre_option_$option, default_option_$option, or option_$option, the returned value may not match the expected type.

So, there are already filters. Exactly which functions need which filters?

I have removed the filter for get_options as there is already a patch https://core.trac.wordpress.org/ticket/37930

Last edited 4 years ago by pbearne (previous) (diff)

#5 follow-up: @pbearne
4 years ago

@SergeyBiryukov this is not a dupe as it is a shortcut filter for WP_load_alloptions

Last edited 4 years ago by pbearne (previous) (diff)

#6 @pbearne
4 years ago

  • Description modified (diff)
  • Keywords has-unit-tests added
  • Summary Add filters to allow the shortcut return for the get options functionsAdd filters to allow the shortcut return to wp_load_alloptions

#7 @pbearne
4 years ago

  • Resolution duplicate
  • Status closedreopened

#8 in reply to: ↑ 5 @SergeyBiryukov
4 years ago

  • MilestoneAwaiting Review

Replying to pbearne:

this is not a dupe as it is a shortcut filter for WP_load_alloptions

Thanks for the clarification! Yeah, let's keep this one for the pre_wp_load_alloptions filter then.

Last edited 4 years ago by SergeyBiryukov (previous) (diff)

#9 @pbearne
4 years ago

  • Owner set to pbearne
  • Status reopenedassigned

#10 @mukesh27
4 years ago

  • Keywords needs-refresh added
  • Milestone Awaiting Review6.1

Hi there!

Thanks for the ticket and PR. It looks good, except for the small problem with the doc block for the filter.

Moving to the 6.1 milestone for consideration.

#11 @pbearne
4 years ago

@mukesh27 fixed doc block
Thanks for the review

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


4 years ago

#13 @davidbaumwald
4 years ago

  • Owner changed from pbearne to davidbaumwald
  • Status assignedreviewing

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


4 years ago

#15 @spacedmonkey
4 years ago

@davidbaumwald Are you good to commit?

#16 @davidbaumwald
4 years ago

@spacedmonkey Yep. I'll work this in after 6.1 Beta 1.

#17 @davidbaumwald
4 years ago

  • Milestone 6.16.2
  • Type defect (bug)enhancement

@pbearne @spacedmonkey I apologize for not catching this sooner, but this is actually an Enhancement not a Bug. As such, this can't be committed to 6.1 since the deadline for FEA/ENH was Beta 1 a couple of days ago.

Updating the ticket to properly type it and punting to 6.2 to make sure it gets in.

This ticket was mentioned in Slack in #core by costdev. View the logs.


4 years ago

#19 @costdev
4 years ago

  • Keywords changes-requested added; needs-refresh removed

I've requested some changes on the PR :) Updating the ticket's keywords to swap needs-refresh for changes-requested.

This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.


4 years ago

#22 @costdev
4 years ago

  • Keywords commit added; changes-requested removed

I have updated the patch to address the remaining feedback. See PR 4016.

Adding for commit consideration.

Additional props: @mukesh27

#23 @spacedmonkey
4 years ago

  • Owner changed from davidbaumwald to spacedmonkey

#24 @spacedmonkey
4 years ago

  • Resolutionfixed
  • Status reviewingclosed

In 55256:

Options, Meta APIs: Add a filter to allow the shortcut return to wp_load_alloptions function.

Add a new filter pre_wp_load_alloptions in the wp_load_alloptions function to short circuit the return value.

Props pbearne, spacedmonkey, joyously, SergeyBiryukov, mukesh27, costdev.
Fixes #56045.

#25 @spacedmonkey
4 years ago

  • Focuses performance added

@spacedmonkey commented on PR #4016:


4 years ago
#26

Committed

@pbearne commented on PR #2857:


4 years ago
#27

code review changes made

#28 @bph
4 years ago

  • Keywords needs-dev-note added

#29 @milana_cap
4 years ago

@pbearne @spacedmonkey, do we have a volunteer to write the Dev note?

#30 @flixos90
4 years ago

Drafted a note for this to be included in the Field Guide's notes section, as shared in https://wordpress.slack.com/archives/C02KGN5K076/p1677531978930639?thread_ts=1677512400.171959&cid=C02KGN5K076.

#31 @spacedmonkey
3 years ago

#54622 was marked as a duplicate.

Note: See TracTickets for help on using tickets.