• Resolved Ambyomoron

    (@josiah-s-carberry)


    I had created an event template that included an iframe with a column of a table. When upgrading from 2.1.8 to 2.1.9, the entire <iframe></iframe> block was deleted. I note, too, that <span> tags were deleted. As a result, the template that had been displayed correctly in events until 2.1.8 no longer is correct.
    Manually restoring the template is of no use, as all those tags get deleted upon saving the template.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Franky

    (@liedekef)

    As a result of wordpress asking me, I made the posting of html as strict as desired by wp, by using wp_kses_post.
    If your span/iframe tags get deleted, check if it is done by wp_kses_post, or maybe just by tinymce. See for example: https://stackoverflow.com/questions/44261039/wordpress-removes-empty-span-tag#44261285 (which contains a solution for tinymce).
    If done by wp_kses_post: use the available wordpress filters to allow extra tags.

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    Thanks for that. I tried adding the suggested code to functions.php but it had no effect on the problem, so I assume the issue concerns wp_kses_post.

    The additional tags I would like to allow are:
    <span style=”display: block;”> and <iframe src= width= height= frameborder= >

    I looked at the codex documentation and various articles about kses but I lack the overall knowledge to implement the necessary code. So, could you indulge me and provide some hints:
    1) I need the new filter to run in the admin back end, when I edit a template and when the template is used with an event. Where does that filter have to be added? In functions.php?

    2) If I understand correctly, it is possible to add both tags and context information for when those tags should be allowed. I recognize that allowing <iframe> is a great big loophole, so there is interest in limiting the changes in the allowed list to <iframe> and <span> in EME templates or events. But I have no idea what to do to achieve this. Any hints?

    3) Further, I presume that the technique should be to first detect which tags are already allowed, which puts the data in a 2 dimensional array, and then concatenating to that array whatever additional information you want about the additional tags. I presume I would have to use array_merge to achieve this, but an not sure. Could you provide an example of what the array of new values should look like, given my explanation above?

    • This reply was modified 7 years, 3 months ago by Ambyomoron.
    Plugin Author Franky

    (@liedekef)

    This seems like a good example:
    https://www.snip2code.com/Snippet/1524788/WordPress-allow-iFrames-with-wp_kses_pos/

    And since span on it’s own is already accepted, the style attribute can be allowed (in the example above) like this:

    $tags[‘span’][‘class’]=>1;

    The next version of EME will have an option that allows you to define extra tags/attributes to allow in EME settings alone.

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    Thanks very much for that. I see that the code needs to be added to functions.php.

    But perhaps I’ll wait for the next version of EME, rather than going the functions.php route.

    Plugin Author Franky

    (@liedekef)

    If you want, you can try out the dev-version …

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘iframe deleted from event template’ is closed to new replies.