• Resolved Gregosz

    (@gregosz)


    Hi,
    When swithing between Visual and Text tabs in text field, in Design tab of the WP Maintenance Mode plugin, the <span> tag is removed.
    I am surpriced as in my functions. php file there is the following piece of code. It works for my blog sites and posts but it does not work for plugin.

    What is the solution?

    // stop wordpress removing span tags
    function uncoverwp_tiny_mce_fix( $init )
    {
    // html elements being stripped
    $init[‘extended_valid_elements’] = ‘span[*]’;

    // pass back to wordpress
    return $init;
    }
    add_filter( ‘tiny_mce_before_init’, ‘uncoverwp_tiny_mce_fix’ );

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Gregosz

    (@gregosz)

    There is an update…

    In fact there is ok now. I found that empty tags are removd, like: <span class = “some-class”> </span>.
    But if we have something like <span class = “some-class”>lorem ipsum</span> it is not removed…
    -:)
    Grzegorz

    Hello @gregosz,

    The plugin is using the same editor as the posts. I just made some tests, and the behavior seems to be the same in both places: the span tag (<span class=”some-class”></span>) is removed (by the editor) only if it is empty.
    Anyway, if you want to add a more complex HTML code, I think you should add it directly to the template.


    George

    • This reply was modified 4 years, 7 months ago by George J.

    After a few other tests, I found out that the editor instance from the plugin also removes the span tag if there is no class attribute (even if the tag is empty or not).

    To solve this issue, open wp-maintenance-mode/views/settings.php, search for wp_editor, and change teeny argument to false. Because when teeny is true, the editor ignores extended_valid_elements.

    • This reply was modified 4 years, 7 months ago by George J.
    • This reply was modified 4 years, 7 months ago by George J.
    Thread Starter Gregosz

    (@gregosz)

    Hi!
    Thank you so much for all the explanations!
    Grzegorz

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Removing span tag form plugin text editor’ is closed to new replies.