How to enable line breaks in private messages (private-messaging)

Hello all,

Is there a possibility to enable line breaks in messages? I think it's a bit annoying that you can only write messages in a block

Thanks in advance

  • Alessandro Schneider

    Hi Kasia,

    thanks for your reply. This works. But older messages written before the use of WYISWYG are still in one line. Besides we do not want to use WYISWYG. The message plugin should only display line breaks because without the WYISWYG editor it is possible to enter line breaks.

    It does not look good at all when there are no line breaks in messages!

    Can you provide a function/filter/hook where to use (possibly) nl2br?


  • Ash

    Hello there

    I hope you are doing good.

    Please try the following code:

    add_filter( 'mm_message_content', 'mm_message_content_cb' );
    function mm_message_content_cb( $msg ) {
        return nl2br( $msg );

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.