WordPress.org

Make WordPress Core

Opened 9 months ago

Closed 5 months ago

#38924 closed defect (bug) (fixed)

Getting 'embed_autourls' option still generates a DB query

Reported by: dlh Owned by: peterwilsoncc
Milestone: 4.8 Priority: normal
Severity: normal Version: 3.5
Component: Embeds Keywords: has-patch commit
Focuses: Cc:

Description

I noticed this behavior while debugging a plugin that checks get_option( 'embed_autourls' ).

default-filters.php contains add_filter( 'default_option_embed_autourls', '__return_true' ), but get_option() will have already queried for the option before that filter is applied.

The attached patch would switch to pre_option_embed_autourls to shortcircuit get_option() before it queries for anything.

Attachments (1)

38924.diff (622 bytes) - added by dlh 9 months ago.

Download all attachments as: .zip

Change History (5)

@dlh
9 months ago

#1 @peterwilsoncc
9 months ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.8
  • Owner set to peterwilsoncc
  • Status changed from new to assigned
  • Version set to 3.5

#2 @swissspidy
7 months ago

  • Keywords commit added

Patch looks good to me.

#3 @SergeyBiryukov
5 months ago

I assume default_option_* was chosen for consistency with default_option_link_manager_enabled added in [21537], but link_manager_enabled option still exists, unlike embed_autourls, so the patch looks good.

#4 @SergeyBiryukov
5 months ago

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

In 40360:

Embeds: Change the embed_autourls option filter from default_option_* to pre_option_* to avoid a DB query.

The option was removed from core in [21998], but still might be used by plugins.

Props dlh.
Fixes #38924.

Note: See TracTickets for help on using tickets.