WordPress.org

Ready to get started?Download WordPress

Forums

HTML being stripped out of scheduled posts (4 posts)

  1. apLundell
    Member
    Posted 1 year ago #

    One of my blogs is about Kickstarter, and I often use their embeddable videos and "project cards".

    These are iframe embeds.

    However, if I schedule a post, then by the time it goes live these iframe blocks have mysteriously vanished into the aether.

    Anyone else experiencing these problems?

  2. Frumph
    Member
    Posted 1 year ago #

    Everyone has, the posts text area doesn't allow most advanced html and scripting code inside of it.

    The way around it is to program a filter that adds to the_content, for example:

    Taken from this post here: http://www.deadhippo.com/2012/09/28/embed-a-kickstarter-video-in-a-wordpress-post/

    function Kickstarter_Parse ($content) {
        global $post;
        $content = preg_replace("/\[kickstarter file=https:\/\/www\.kickstarter\.com\/projects\/([^ ]+) \/\]/i","<iframe frameborder=\"0\" height=\"410px\" src=\"https://www.kickstarter.com/projects/$1/widget/video.html\" width=\"480px\"></iframe>",$content);
    
        return $content;
    }
    
    add_filter('the_content', 'Kickstarter_Parse');

    Then you do [kickstarter file=https://theurlofthekickstartervideo] inside your post and that will retranslate it out to the whole iframe code.

  3. apLundell
    Member
    Posted 1 year ago #

    Thanks Frumph.

    Odd,though. That post is from September. This was working fine for me until 3.5. (I should have mentioned as much. )

    Very frustrating to lose functionality like that, but I'll try doing it the way you suggest. )

    (If any developers are reading this, I'd like to suggest that it's dangerous to allow iframes in previews and live post editing, but then strip then out of scheduled posts when they go live. That's the worst possible time to make changes without the user's knowledge! )

  4. apLundell
    Member
    Posted 1 year ago #

    To anyone else is having this problem :

    If I'm reading this right, it looks like the problem has been identified and fixed. (Bug ticket #22944)

    Just have to be patient and wait for version 3.5.1

Topic Closed

This topic has been closed to new replies.

About this Topic