Importing posts, preserving YouTube embeds

I've imported Wordpress posts from my old site to my new site. The import worked fine, except for one point: YouTube embed code was stripped from my posts.

Is there a way to preserve that YouTube embed code when I perform the embed? In performing a little bit of research online, some people suggested that the solution would be to edit the kses.php file in the wpincludes folder to "comment out" the Post Filtering code. Is that what I do? And, how do I comment out something? Just add a hashtag?

Thank you!

  • Nastia
    • Support Rock Star

    Hello Bryan , hope you're doing well!

    Please let me know what method you've chosen to import posts? Would you please share with us the link to your site and grant access from WPMU DEV > Support so we could have a closer look at imported HTML code?

    Please see the detailed instructions on the link below:

    Let me know when you do!

    Kind regards,

  • Nastia
    • Support Rock Star

    Hello Bryan ,

    Hope you're doing well!

    Thank you for granting access, I've visited your site and the youtube video links are there, they just wrapped around an image. Some images exist in your media library, and other are missing.

    So the HTML content looks like this:

    <a href="" rel="attachment wp-att-79355"><img class="aligncenter wp-image-79355" src="" alt="" width="600" height="334" /></a>

    Based on the WordPress settings, I guess you've used WordPress importer tool, would you please try to import the posts using Import any XML or CSV File to WordPress plugin and make sure to check the option to import images:

    This will download the images from XML file to your posts.

    Please let me know if I missed any post where the youtube URL is entirely missing.

    Kind regards,

  • Bryan
    • WPMU DEV Initiate

    No, my youtube code is not being imported. The youtube code you saw was in posts that were created in the normal post process. They were not posts that were imported.

    I am importing an xml file. The embedded youtube code is in the xml code, but the import process seems to strip that code from the post.

  • Sajid
    • DEV MAN’s Sidekick

    Hello Bryan,
    Hope you are doing good today :slight_smile:

    I am unable to replicate this issue on my own site. The youtube video embeds are being imported along other content from one site to another.

    I tried the with youtube link in the post editor and also the traditional iframe embed method into a post.

    Both worked for me, while exporting from source site to target site via XML and WordPress importer.

    So the point is, how actually you imported videos on your target site ? Currently, there are two sites registered with your account and both have support staff access disabled.

    Could you please give support staff access for both of your sites so I could take a closer look and see how exactly you embedded the youtube video on your site ? Also please mention what is source site and what is target site.

    Take care and have a nice day :slight_smile:

    Best Regards,
    Sajid - WPMU DEV Support

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.