WP_Embed::maybe_run_ajax_cache() WordPress Method
The WP_Embed::maybe_run_ajax_cache() method is used to check if a cached version of the embed code exists for a given URL. If a cached version exists, it is returned. If not, the method attempts to fetch the embed code from the remote site.
WP_Embed::maybe_run_ajax_cache() #
If a post/page was saved, then output JavaScript to make an Ajax request that will call WP_Embed::cache_oembed().
Source
File: wp-includes/class-wp-embed.php
public function maybe_run_ajax_cache() { $post = get_post(); if ( ! $post || empty( $_GET['message'] ) ) { return; } ?> <script type="text/javascript"> jQuery( function($) { $.get("<?php echo esc_url( admin_url( 'admin-ajax.php', 'relative' ) ) . '?action=oembed-cache&post=' . $post->ID; ?>"); } ); </script> <?php }
Expand full source codeCollapse full source codeView on TracView on GitHub