WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/07/2015 10:35:18 AM (4 years ago)
Author:
pento
Message:

Embeds: Add oEmbed provider support.

For the past 6 years, WordPress has operated as an oEmbed consumer, allowing users to easily embed content from other sites. By adding oEmbed provider support, this allows any oEmbed consumer to embed posts from WordPress sites.

In addition to creating an oEmbed provider, WordPress' oEmbed consumer code has been enhanced to work with any site that provides oEmbed data (as long as it matches some strict security rules), and provides a preview from within the post editor.

For security, embeds appear within a sandboxed iframe - the iframe content is a template that can be styled or replaced entirely by the theme on the provider site.

Props swissspidy, pento, melchoyce, netweb, pfefferle, johnbillion, extendwings, davidbinda, danielbachhuber, SergeyBiryukov, afercia

Fixes #32522.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-filters.php

    r34855 r34903  
    423423add_filter( 'media_send_to_editor', 'image_media_send_to_editor', 10, 3 );
    424424
     425// Embeds
     426
     427add_action( 'parse_query', 'wp_oembed_parse_query' );
     428
     429add_action( 'wp_head', 'wp_oembed_add_discovery_links' );
     430add_action( 'wp_head', 'wp_oembed_add_host_js' );
     431
     432add_action( 'oembed_head', 'print_emoji_detection_script' );
     433add_action( 'oembed_head', 'print_emoji_styles' );
     434add_action( 'oembed_head', 'print_oembed_embed_styles' );
     435add_action( 'oembed_head', 'print_oembed_embed_scripts' );
     436add_action( 'oembed_head', 'wp_print_head_scripts', 20 );
     437add_action( 'oembed_head', 'wp_print_styles', 20 );
     438add_action( 'oembed_head', 'wp_no_robots' );
     439add_action( 'oembed_head', 'rel_canonical' );
     440add_action( 'oembed_head', 'locale_stylesheet' );
     441
     442add_action( 'oembed_footer', 'wp_print_footer_scripts', 20 );
     443
     444add_filter( 'excerpt_more', 'wp_oembed_excerpt_more', 20 );
     445add_filter( 'the_excerpt_embed', 'wptexturize' );
     446add_filter( 'the_excerpt_embed', 'convert_chars' );
     447add_filter( 'the_excerpt_embed', 'wpautop' );
     448add_filter( 'the_excerpt_embed', 'shortcode_unautop' );
     449add_filter( 'the_excerpt_embed', 'wp_oembed_excerpt_attachment' );
     450
     451add_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10, 3 );
     452add_filter( 'oembed_response_data', 'get_oembed_response_data_rich', 10, 4 );
     453
    425454unset( $filter, $action );
Note: See TracChangeset for help on using the changeset viewer.