Hi,
After the snippet has been posted to the editor, it is out of the plugin’s control. What you are seeing here is probably a native feature of WordPress, that users with the Editor role are not allowed to freely add custom HTML, JS etc to posts.
Ie, see here: http://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table
So when the editor goes to a post, and saves it, even if it were ok previously when an admin saved it, the editor resaving it will then remove the code.
That’s the nature of the editor role in WP. You can verify if it relates to the plugin or not, by pasting the code manually into a post, as an editor, and save it, and see if it stays or gets removed.
What you could do, is to use it as a shortcode instead, that should circumvent the filtering for editors, as no code is actually placed in the posts when using it as a shortcode.
Thank you for your thorough explanation, Johan. I understand. As you advised I used shortcodes. I have to forget about variables but it works.
Thank you very much for your plugin.
Fran, you can use variables with shortcodes too.
Yes but variables with shortcode enounters the same WP problem when the editor edits and saves the page. If the content of the variable is some html code like iframe for instance, WP deletes it anyway.
Or did I miss something?
I also just noticed something when trying a variable with shortcode. Even as admin, if the content of the variable is too long, it shows nothing on the front end. (I think it has something to do with the length, I am not sure).
For instance,
When I set the variable content to
<b>Bonjour</b>
It works perfectly. It shows “Bonjour” in bold.
But when I set the variable content to (Google map)
<iframe style="border: 0;" src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d2521.0806778792153!2d4.4045879999999995!3d50.8111439!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x47c3db2ce9861ab3%3A0xf7692459ac5fb52b!2sRue+des+B%C3%A9gonias+55%2C+1170+Watermael-Boitsfort!5e0!3m2!1sfr!2sbe!4v1411590676042" width="300" height="300" frameborder="0"></iframe>
Nothing is displayed on the front end although the whole shortcode is there on the back end, also in Text view.