• As of version 4.4, WordPress has become an oEmbed provider. I am trying to embed a WordPress post in the page in the “Link to the page you need help with” field. Do not be confused; the page in the “Link to the page you need help with” field is NOT a WordPress page. But I have a WordPress site that obeys the same-origin policy. I am using the “HTML Embed” feature of the new Gutenberg editor to get the code needed to embed WordPress content on a non-WordPress site.

    My issue is that I need to refactor the oEmbed code slightly. My main site uses an in-house Content Management System (CMS) to display the content, and that CMS uses CKEditor as its text editor. CKEditor filters out any and all content between <script></script> tags. I need to put the JavaScript in an external script and call it with the “src” attribute. The problem is that there is a CDATA section within the script. The actual block that the script executes is wrapped in the CDATA section.

    I have a hunch that I may be able to externalize the script. For one thing, I believe that the script content is constant no matter what post is being embedded. For another, I don’t think it’s really necessary to have the CDATA wrapper. I’m asking the WordPress developers if this will work.

    • This topic was modified 6 years, 3 months ago by ssimo3.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Since your issue is not about WordPress support, I suggest either posting in the “Developing With” forum of on WordPress.stackexchange.com
    If the script contains CDATA, then it is very necessary.

    Have you thought of creating a custom page template and embedding the script in the template?

    Thread Starter ssimo3

    (@ssimo3)

    I’m actually working on it. I’ve discovered what I think is a new bug in the process, though: I have added <base target="_blank" /> to my WordPress theme’s header-embed.php, but I cannot get WordPress to obey it. If I embed non-WordPress content into an iframe that has <base target="_blank"/>, it works just fine; it is broken only on WordPress as an oEmbed provider.

    And yes, before you ask, I have tried removing the sandbox attribute.

    • This reply was modified 6 years, 3 months ago by ssimo3.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘oEmbed script tags’ is closed to new replies.