Rich Text Tags
No line breaks in version 1.4 (6 posts)

  1. 19dozen
    Posted 4 years ago #


    I don't appear to be getting any line breaks when using the plugin. In fact toggling between the rich and text boxes seems to show that, although HTML is being added (I tried this by emboldening the text) no line breaks are at all.

    All help is greatly appreciated.

    All the best,


  2. Chris Van Patten
    Posted 4 years ago #

    I've looked into this a bit. It turns out the line breaks are being saved (view source and you'll see) but they aren't being wrapped properly with <p> tags.

    If you filter the output of your descriptions with wpautop (for example, echo wpautop( $posttag->description );) WordPress adds those <p> tags back in. However because they aren't being saved as part of the description itself, TinyMCE ignores those line breaks when it initializes. TinyMCE only recognizes <p> or <br /> line breaks (since it's basically an HTML processor, and HTML ignores white space).

    Is there a way to filter the descriptions with wpautop before they load in the TinyMCE editor, to preserve the linebreaks?

  3. 19dozen
    Posted 4 years ago #

    I've not had a chance to look at this again since posting. Yes Chris, you're correct, they initially get saved but no P tags are being saved with them. The problem doesn't seem to occur when you save the database actually. I typed in the wysiwyg box, two paragraphs of text with one of the words emboldened. When I then toggles the wysiwyg editor off no P tags were present in the text box. The tags to emboldening the word were there, however, making me think that this is some sort of problem with the way TinyMCE is set up.

    I don't think that filtering the content is really the way to go actually. The markup should really appear when TinyMCE is turned off. is anyone capable of troubble-shooting this at all??


  4. Chris Van Patten
    Posted 4 years ago #

    Filtering the content is half the battle.

    If you do something like this...

    function display_multiline_taxonomy_description($description) {
    	return wpautop($description);
    add_filter('pre_taxonomy_description', 'display_multiline_taxonomy_description');

    ... you get the intended results, unless you switch over to plain text mode and then back. The editor doesn't know to treat the line breaks as paragraph breaks.

    It does preserve paragraphs on save though, and keeps them when the TinyMCE editor first loads. So for my clients (who don't need the plain text editor) I've manually disabled the plain text version of the tag/category editor and called this the best stop-gap solution until the plugin author fixes the plugin once and for all... which I hope is soon.

  5. 19dozen
    Posted 4 years ago #

    Thanks for the message :-)

    I stuck that code in my functions.php file but it didn't seem to work. Any thoughts?? I'm quite open to the possibility that I put it in the wrong place.

  6. tamlyn
    Posted 4 years ago #

    You need to replace 'taxonomy' in pre_taxonomy_description with the slug of your taxonomy. So if it is called my-taxonomy then the line would read:

    add_filter('pre_my-taxonomy_description', 'display_multiline_taxonomy_description');

    Thanks Chris.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Rich Text Tags
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic