WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 2 years ago

#33958 closed enhancement (fixed)

All Options Filter

Reported by: sebastian.pisula Owned by: pento
Milestone: 4.9 Priority: normal
Severity: normal Version:
Component: Options, Meta APIs Keywords: has-patch has-unit-tests
Focuses: performance Cc:
PR Number:

Description

Add filter for all options

Attachments (2)

33958.patch (491 bytes) - added by sebastian.pisula 4 years ago.
33958.1.patch (4.7 KB) - added by keesiemeijer 3 years ago.
Add filters and unit tests

Download all attachments as: .zip

Change History (19)

#1 @sc0ttkclark
4 years ago

Can you describe your use-case? Usually when a patch is submitted, we require an explanation of how you would use it and an example of why it's needed.

#2 @johnbillion
4 years ago

  • Keywords reporter-feedback added

#3 @netweb
4 years ago

This looks like a duplicate of your previous ticket #33858 @sebastian.pisula, how is this ticket different?

#4 @johnbillion
4 years ago

#34337 was marked as a duplicate.

#5 @johnbillion
4 years ago

  • Keywords close added

@sebastian.pisula Can you provide some more info about your use-case and why this filter is needed? Thanks.

#6 @sebastian.pisula
4 years ago

for example ACF Pro, options page. when I use get_field('field', 'options'); then I send request to MySQL for each get_field. I will be can use filter to merge Options and I will be use get_option to get Options From ACF Options Page.

#7 @johnbillion
4 years ago

#34337 was marked as a duplicate.

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


4 years ago

#9 @pento
3 years ago

  • Focuses performance added
  • Keywords has-patch needs-refresh needs-unit-tests added; reporter-feedback close removed
  • Milestone changed from Awaiting Review to 4.8
  • Owner set to pento
  • Status changed from new to assigned

A similar filter is used on WP.com, before the wp_cache_add() in wp_load_alloptions(), to ensure that $alloptions isn't too big for the cache to handle.

A pre_cache_alloptions along with the proposed alloptions filter would be valuable.

@keesiemeijer
3 years ago

Add filters and unit tests

#10 @keesiemeijer
3 years ago

  • Keywords has-unit-tests added; needs-refresh needs-unit-tests removed

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


3 years ago

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


3 years ago

#13 @jbpaul17
3 years ago

  • Milestone changed from 4.8 to 4.8.1

Punting to 4.8.1 per today's bug scrub.

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


2 years ago

#15 @pento
2 years ago

  • Milestone changed from 4.8.1 to 4.9

Punting to 4.9.

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


2 years ago

#17 @pento
2 years ago

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

In 41627:

Options: Add new alloptions and pre_cache_alloptions filters.

pre_cache_alloptions is run before the alloptions array is inserted into the cache, and is valuable for sanity checking the options, particularly if your caching scheme has size limitations.

alloptions is run before returning the alloptions array, and is useful for when you have extra information that alloptions should return.

Props sebastian.pisula, keesiemeijer.
Fixes #33958.

Note: See TracTickets for help on using tickets.