Normally this is not required, but if you're running an old installation of WordPress and you're facing issues with the oEmbed cache, the script below may solve the issue.

oEmbed is what WordPress uses to grab embed code for several different embeddable content (for example, YouTube and Vimeo videos). But sometimes the embed code that your WordPress receives through oEmbed is damaged. If this happens, the only solution is to clear your oEmbed cache so that WordPress knows it needs to try to fetch the new embed code.

This is not recommended, nor required under normal circumstances, but it works really well as a fix if you're constantly in the position where you need to clear the oEmbed cache every time you add a new Course.

You need to add the following PHP Snippet in your installation, either in the child theme functions.php, or as a separate plugin.


add_action('save_post', function($post_id) {
  if (get_post_type($post_id) = !eLearnCommerce_POST_TYPE_COURSE)
  global $wpdb;

  $wpdb->query ('DELETE FROM`'.$wpdb->postmeta. '`WHERE `meta_key` LIKE "_oembed%" AND post_id='.$post_id);
Did this answer your question?