add_editor_style() only in backend
-
I would like to customize the TinyMCE editor styles, but only when I’m in the backend, not when I’m using Elementor interface to edit posts.
I’m using
add_editor_style()
method, but it loads also in the frontend when Editing with Elementor.I tried the following checks, but they are always true:
is_admin()
returns true even when editing with Elementor in frontend
global $pagenow
is alwayspost.php
whether I’m editing from backend or frontend with elementor.Tried to apply this solution: https://github.com/elementor/elementor/issues/4491
but both suggestions:
–\Elementor\Plugin::$instance->editor->is_edit_mode()
–\Elementor\Plugin::$instance->db->is_built_with_elementor($post->ID)
return Fatal error: Uncaught Error: Call to a member function.
The only workaround I could find is to use specific rules in editor style css not to target the Elementor TinyMCE window:
body#tinymce.wp-editor:not(.elementorwpeditor)
but this is not an optimal solution, as I need to load some Google and Icon fonts that are already loaded by Elementor.
How could I check if I’m editing from the backend or frontend?
thanks
- The topic ‘add_editor_style() only in backend’ is closed to new replies.