WordPress.org

Make WordPress Core

Opened 7 years ago

Last modified 3 years ago

#17857 new enhancement

WP_Embed - Split shortcode() function into two for increased flexibility

Reported by: r-a-y Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 2.9
Component: Media Keywords: has-patch reporter-feedback 2nd-opinion
Focuses: Cc:

Description

Currently, the WP_Embed class is restricted to posts; it takes a post ID as a parameter and checks the post meta table.

What I'd like to propose is to apply a filter to the post ID and split WP_Embed::shortcode() into two functions (at http://core.trac.wordpress.org/browser/trunk/wp-includes/media.php#L1177).

In a nutshell, let the link parsing be one function and if the link is oEmbed-worthy send it to the second function for parsing. The second function could then be easily extended for usage in 3rd-party plugins not using WP posts (like BuddyPress).

Also, the patch checks the URL against each registered WP oEmbed provider's URL scheme if oEmbed discovery is false. This is designed to prevent unnecessary external pinging of an oEmbed provider and avertible meta caching for failed attempts. Andy Peatling primarily wrote this part of the code, which he sent to me awhile ago.

Attached patch is against r18324.

Attachments (1)

17857.001.patch (4.1 KB) - added by r-a-y 7 years ago.

Download all attachments as: .zip

Change History (5)

#1 @r-a-y
7 years ago

  • Version changed from 3.1.4 to 3.2

#2 @nacin
7 years ago

  • Version changed from 3.2 to 2.9

@r-a-y
7 years ago

#3 @ericlewis
4 years ago

  • Keywords reporter-feedback added

@r-a-y still interested in this? Can you spell out a use case more clearly, not sure I'll get the drift without diving deep.

#4 @chriscct7
3 years ago

  • Keywords 2nd-opinion added
Note: See TracTickets for help on using tickets.