Javascript embedded disappears for editors

The question:

WP multisite installation ver 5.2.11
Plugin Advanced Access Manager 6.5.4 licensed
This plugin creates and manages different level of users with different privileges.
Already asked to the seller’s customer service without replies

We frequently inserted an embedded code as this:

<div id="buzzsprout-player-8580256"></div>

<script src="https://www.buzzsprout.com/1626286/8580256-24-05-21-l-affascinante-mondo-delle-fiabe.js?container_id=buzzsprout-player-8580256&player=small" type="text/javascript" charset="utf-8"></script>

We created a lower level of access for some specific editors.
For them the code embedded looses the script: after saving the page the code remains only made by the div

<div id="buzzsprout-player-8580256"></div>

Why does it loose the script?
What could we do to avoid this issue?

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

WordPress Multisite disallows the unfiltered_html capability for non-super-admin (ie, any users who are not capable of performing network administration). Anyone without the unfiltered_html capability will not be able to save post content with disallowed HTML tags, including <script> tags.

A quick search shows that there have been attempts at modifying this behaviour, but they may have been invalidated by subsequent updates to WordPress core.

See this answer for a possible solution (though it may not work anymore.)


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment