Make WordPress Core

Opened 2 years ago

Closed 16 months ago

Last modified 13 months ago

#56045 closed enhancement (fixed)

Add filters to allow the shortcut return to wp_load_alloptions

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

Description (last modified by pbearne)

This adds a shortcut filter to the wp_load_options function

Change History (31)

#1 follow-up: @joyously
2 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.


2 years ago
#2

  • Keywords has-patch added

#3 @SergeyBiryukov
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there, thanks for the ticket and the PR!

This looks like a duplicate of #37930.

#4 in reply to: ↑ 1 @pbearne
2 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 2 years ago by pbearne (previous) (diff)

#5 follow-up: @pbearne
2 years ago

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

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

#6 @pbearne
2 years ago

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

#7 @pbearne
2 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

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

  • Milestone set to Awaiting 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 then.

Version 0, edited 2 years ago by SergeyBiryukov (next)

#9 @pbearne
2 years ago

  • Owner set to pbearne
  • Status changed from reopened to assigned

#10 @mukesh27
23 months ago

  • Keywords needs-refresh added
  • Milestone changed from Awaiting Review to 6.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
23 months ago

@mukesh27 fixed doc block
Thanks for the review

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


22 months ago

#13 @davidbaumwald
22 months ago

  • Owner changed from pbearne to davidbaumwald
  • Status changed from assigned to reviewing

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


21 months ago

#15 @spacedmonkey
20 months ago

@davidbaumwald Are you good to commit?

#16 @davidbaumwald
20 months ago

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

#17 @davidbaumwald
20 months ago

  • Milestone changed from 6.1 to 6.2
  • Type changed from defect (bug) to 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.


16 months ago

#19 @costdev
16 months 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.


16 months ago

#22 @costdev
16 months 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
16 months ago

  • Owner changed from davidbaumwald to spacedmonkey

#24 @spacedmonkey
16 months ago

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

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
16 months ago

  • Focuses performance added

@spacedmonkey commented on PR #4016:


16 months ago
#26

Committed

@pbearne commented on PR #2857:


16 months ago
#27

code review changes made

#28 @bph
15 months ago

  • Keywords needs-dev-note added

#29 @milana_cap
15 months ago

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

#30 @flixos90
15 months 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
13 months ago

#54622 was marked as a duplicate.

Note: See TracTickets for help on using tickets.