How can I remove p tags that are auto added within tinymce

前端 未结 11 1915
挽巷
挽巷 2020-12-06 04:46

I am using tinymce 4.0.1 and it automatically adds p tags when you either start typing or hit enter. How can I dynamically remove these p tags and then reinsert the content

11条回答
  •  一个人的身影
    2020-12-06 04:50

    Add this to your functions.php file and the standard

    tags will be removed by adding some parameters to the tiny_mce_before_init hook. If you want to see how it works, you can read further on this page: https://codex.wordpress.org/TinyMCE

    ////////////////////////////////////////////////////////////////////////
    //////////REMOVE STANDARD 

    FROM TINYMCE EDITOR///////////////////////// /////////////////////////////////////////////////////////////////////// function my_format_TinyMCE( $in ) { $in['forced_root_block'] = ""; $in['force_br_newlines'] = TRUE; $in['force_p_newlines'] = FALSE; return $in; } add_filter( 'tiny_mce_before_init', 'my_format_TinyMCE' );

提交回复
热议问题