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(document).ready(function($){
		$.get("<?php echo esc_url( admin_url( 'admin-ajax.php', 'relative' ) ) . '?action=oembed-cache&post=' . $post->ID; ?>");
	});
</script>
		<?php
	}

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_embed/maybe_run_ajax_cache