WordPress.org

Make WordPress Core

Opened 3 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
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 3 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 r-a-y3 years ago

  • Version changed from 3.1.4 to 3.2

comment:2 nacin3 years ago

  • Version changed from 3.2 to 2.9

r-a-y3 years ago

Note: See TracTickets for help on using tickets.