• Hallo, after i updated to the latest version, i get automatically added <p> around all paragraphs, when i switch from html to visual. if i deactivate “Keep paragraph tags” in the setting, i cannot see any br or p at all. So, how can i keep activated “Keep paragraph tags” in the setting but stop tinymce adding <p> to the text (and still see/add the <br> tags) when i switch from html to visual in the editor?

    in the functions.php i have:

    function tinymce_remove_root_block_tag( $init ) {
        $init['forced_root_block'] = false;
        return $init;
    }
    add_filter( 'tiny_mce_before_init', 'tinymce_remove_root_block_tag' );

    and

    remove_filter( 'the_content', 'wpautop' );
    remove_filter( 'the_excerpt', 'wpautop' );

    https://www.ads-software.com/plugins/tinymce-advanced/

Viewing 15 replies - 1 through 15 (of 18 total)
  • Thread Starter W2014

    (@w2014)

    Actually, the bug is new in the Version 4.3.10.1, the old Version behaved like it should. So i would not advice anyone to install the new Version. I have the old Version 4.3.10 on another site and everything is ok. So I downgraded to 4.3.10.

    Plugin Author Andrew Ozz

    (@azaozz)

    This appears to be a changer in TinyMCE itself. In any case, setting forced_root_block to false triggers (many) other bugs in TinyMCE and is not recommended.

    Not sure why you need to not have any <p> tags in your posts. That makes the text not wrap when the font is different or the screen is small and is something all sites try to avoid.

    Thread Starter W2014

    (@w2014)

    Hallo Andrew,

    thankx for the reply,

    the point is not that i don’t want p tags, but when i switch to visual, all the text is <p> – tagged, so i think, this is something that nobody wants. there are also some issues with p-tags in the browser. but anyway, you have also situations whre you don’t want the p tag…so that is the issue.

    Plugin Author Andrew Ozz

    (@azaozz)

    …when i switch to visual, all the text is <p> – tagged

    You mean you can actually see the <p> in the Visual editor? Then in the Text editor they should appear as &ltp&gt. Think you can delete these, preferably from the Visual editor.

    Thread Starter W2014

    (@w2014)

    Hello, Andrew, i mean in the html/code editor i have:

    some text<br />
    some text

    in the visual i should have:
    sometext
    sometext

    when i switch to visual, i have:
    sometext

    sometext

    and in the html-mode/code editor i have:

    <p>some text</p><br />
    <p>some text</p>

    that is a bug, the editor changes every simple text to paragraph.

    Plugin Author Andrew Ozz

    (@azaozz)

    Testing with your example

    some text<br />
    some text

    pasting it in the Text editor then switching to Visual and back.

    If the “Keep paragraph tags” option is enabled I get

    <p>some text<br />
     some text</p>

    If it is disabled I get

    some text
    some text

    (no <br /> or <p> tags as they are all stripped by wpautop).

    So there must be something else that messes things up. Maybe there is another plugin that affects wpautop or maybe check your theme’s functions.php for more hacks?

    Thread Starter W2014

    (@w2014)

    exactly…sorry…that is what i get also…but that is not correct.
    If the “Keep paragraph tags” option is enabled, the text should remain as it is, not adding <p></p> to it. Keep paragraph tags means, keep the tag -> if there, not add paragraph to the text.
    what must i do to keep the original tags?
    version 4.3.10 makes this:

    some text<br />
    some text

    version 4.3.10 works like expected. it “keeps” the tags, but it does not add any.

    version 4.3.10.1 makes this:

    <p>some text<br />
     some text</p>

    the <p>-tag was added to the text.
    for me this is a huge bug. that can mess up all your layout.

    Plugin Author Andrew Ozz

    (@azaozz)

    Keep paragraph tags means, keep the tag if there, not add paragraph to the text.

    Exactly. All the P tags you see are actually in the Visual editor. (If you don’t trust me, right-click on one and look in the browser console.) ??

    This is how HTML works, and there is no difference in that respect between 4.3.10 and 4.3.10.1.

    Thread Starter W2014

    (@w2014)

    Andrew, sorry, but i think you don’t understand what i mean.
    what i mean is:

    in the version 4.3.10 you don’t have these tags. i’m not talking about tags i in the visual but in the html editor. so, when i write:

    some text<br />
    some text

    and klick “Keep paragraph tags” i want everything to stay as it is. that is ok in the version 4.3.10. in the latest version, i write:

    some text<br />
    some text

    and when i switch to the visual and then back, i have in the html editor:

    <p>some text<br />
     some text</p>

    so, everything is paragraphed. i talk about the html/text editor, not about the visual. for me this is a huge bug, i can’t understand that nobody is disturbed about this. can this behaviour come from the functions.php? i don’t think so…

    Thread Starter W2014

    (@w2014)

    you have to install version 4.3.10, check “Keep paragraph tags” and write in the html editor:

    some text
    some text

    switch from html to visual and back to html:

    it remains:

    some text
    some text

    like it should. in 4.3.10.1, i make the same, the result in the html editor:

    <p>some text
    some text</p>

    if i have this in a div, that messes up all my css.

    Plugin Author Andrew Ozz

    (@azaozz)

    Ah, I think I (finally) understand. You are enabling “Keep paragraph tags” in this plugin (i.e. disabling wpautop() that removes them) and at the same time disabling paragraph tags in TinyMCE, so they are never created.

    I think there was a change in TinyMCE about the forced_root_block option. Also see the warning here: https://www.tinymce.com/docs/configure/content-filtering/#forced_root_block and the discussion here: https://github.com/tinymce/tinymce/issues/2634.

    This comes directly from TinyMCE itself, not in the TinyMCE Advanced plugin.

    Thread Starter W2014

    (@w2014)

    Hallo Andrew, i don’t know where this bug comes from, but how can i stop putting <p> around all text, that is really annoying?
    version 4.3.10 works normally. you mean, that they changed something in tinyMCE? why don’t you use the bug-free older version as a base until there is a new version? otherwise, this is also a TinyMCE Advanced bug.

    i have now a clean functions.php, no wpautop, no force root…etc…the <p> bug is still there.

    Thread Starter W2014

    (@w2014)

    when i load the standard wp-editor, it does not add the p. so that is a bug in TMA.

    Plugin Author Andrew Ozz

    (@azaozz)

    …why don’t you use the bug-free older version as a base until there is a new version?

    The TinyMCE editor is included in WordPress. When you update WordPress most likely there is a new TinyMCE version included in the update too.

    The TinyMCE Advanced plugin extends and enhances the default TinyMCE editor in WordPress.

    The “hacks” you had in your theme’s functions.php were setting additional options for the TinyMCE editor in WordPress regardless of you using this plugin or not.

    If you don’t want to see the <p> tags, disable the “Keep paragraph tags” option in TinyMCE Advanced. Note that this plugin neither adds or removes the <p> tags, it only disables the WordPress script that removes them.

    Thread Starter W2014

    (@w2014)

    Hello Andrew, i still have this problem. Every Text that is not formatted will get a <p> Tag when i switch from text/html to visual and then back to html. How can i maintain the Text unformatted?

    So i write in html: aaa
    Then switch to visual.
    The Back to html and i have <p>aaa</p>. that is crazy.

    thanks, gabriel

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘automatically added p – bug still there in visual editor’ is closed to new replies.