Hi guys!
So, I have this website where I have been using a plugin to add some extra functionality to my YouTube embeds.
But: I have decided that <strong>I don't want to use this plugin anymore.</strong>
The plugin works like this:
I add the YouTube URL to a custom field and then I add the video to the post with a shortcode.
Problem is, I would like to uninstall the plugin and just embed YouTube videos the "normal" WordPress way again, by pasting the YouTube URL in the content edit box in the WordPress admin.
So, I'm looking for a solution to be able to copy the content (The YouTube URL) from the custom field of every post with a video, and replace the shortcode with this content.
I'm not sure if a search and replace in phpmyadmin might be the answer, but I would really like it if I didn't have to go through the hundreds of posts manually...
Thanks for your time!
// Jens.
Hariprasad Vijayan answers:
Hello Jens,
Which plugin you are using?
Regards,
Hariprasad
Jens Filipsson comments:
It's a premium plugin, so it's hard for you guys to try it out without paying for it...
Hariprasad Vijayan comments:
Try this method,
Deactivate plugin and create shortcode with same name.
function fnc_create_shortcode( $atts ) {
$youtube = get_post_meta(get_the_ID(), 'custom field name', true); // change "custom field name" with your custom field.
$embed_code = '';
if($youtube)
{
$embed_code = wp_oembed_get($youtube);
}
return $embed_code;
}
add_shortcode( 'shortcode_name', 'fnc_create_shortcode' ); // change shortcode_name with your shortcode