WordPress 4.4
[autoinstalls/wordpress.git] / wp-includes / class-wp-embed.php
index 74051970948d3b2e790d88f7f313ed8a39808f2d..730fc4fc910481cffe63334ca20f7ed548b61803 100644 (file)
@@ -35,6 +35,7 @@ class WP_Embed {
 
                // After a post is saved, cache oEmbed items via AJAX
                add_action( 'edit_form_advanced', array( $this, 'maybe_run_ajax_cache' ) );
+               add_action( 'edit_page_form', array( $this, 'maybe_run_ajax_cache' ) );
        }
 
        /**
@@ -232,12 +233,13 @@ class WP_Embed {
                         * Filter whether to inspect the given URL for discoverable link tags.
                         *
                         * @since 2.9.0
+                        * @since 4.4.0 The default value changed to true.
                         *
                         * @see WP_oEmbed::discover()
                         *
-                        * @param bool $enable Whether to enable `<link>` tag discovery. Default false.
+                        * @param bool $enable Whether to enable `<link>` tag discovery. Default true.
                         */
-                       $attr['discover'] = ( apply_filters( 'embed_oembed_discover', false ) && author_can( $post_ID, 'unfiltered_html' ) );
+                       $attr['discover'] = ( apply_filters( 'embed_oembed_discover', true ) );
 
                        // Use oEmbed to get the HTML
                        $html = wp_oembed_get( $url, $attr );
@@ -271,7 +273,7 @@ class WP_Embed {
                if ( empty($post_metas) )
                        return;
 
-               foreach( $post_metas as $post_meta_key ) {
+               foreach ( $post_metas as $post_meta_key ) {
                        if ( '_oembed_' == substr( $post_meta_key, 0, 8 ) )
                                delete_post_meta( $post_ID, $post_meta_key );
                }