ckeditor doesn´t read media embed code
I assume that you use CKEditor 4.1.x which comes with Advanced Content Filter (ACF). Most likely, the point is that you use different editors for frontend/backend editing.
Each plugin extends allowedContent property with own rules for tags, attributes and classes. Using those rules, editor automatically strips out undesired contents, so for example, if your fronted editor allows <iframe>
because it has mediaembed plugin loaded, then your backend editor without this plugin will remove your <iframe>
from the content.
Furthermore, ACF also observes your toolbar configuration so even if you include the plugin but you don't want the button in the toolbar, any content the button provides (i.e. <iframe>
) will also be disallowed in editor's output.
You can easily check whether your editor accept <iframes>
. Basically call the following and see the output:
CKEDITOR.instances.yourInstance.filter.check( 'iframe' );
>>> true // it's allowed
If it's false
, then there are several solutions for your problem:
- Enable mediaembed plugin in your backend editor (with button in the toolbar).
- Extend
config.extraAllowedContent
to have it back again.
While the first solution is straightforward, the second one might be tricky for you. allowedContent
rule for mediaembed plugin is as follows (see plugin's code):
allowedContent: 'iframe[*]' // stands for: iframe element with any attribute
If you add the following to your backend editor's config, you will have iframes back in your content without loading mediaembed plugin:
config.extraAllowedContent = 'iframe[*]'
If this solution doesn't work for you, please provide editor configs and CKEditor version so that people could help you.
CKEDITOR.config.allowedContent = true;
work for me.