FCKEditor: Remove & prevent <p> tags from wrapping your content.

For some reason, FCKEditor automatically wraps any content entered into the textbox with a <p> tag. This can cause for some problems in your layout when you’re actually displaying the content. Instead of trying to fix this in your layout with CSS, there is a quick and easy way to turn the auto-wrap off in FCKEditor: Change the FCKConfig.EnterMode setting from ‘p’ to ‘br’. There are a few ways to handle this:

  • Edit fckconfig.js:
    Change FCKConfig.EnterMode = 'p'; to FCKConfig.EnterMode = 'br';
  • Change the setting programatically when you instantiate the object, like so (in PHP):
    $oFCKeditor = new FCKeditor('description');
    $oFCKeditor->BasePath = '/fckeditor/';
    $oFCKeditor->Value = 'some text';
    $oFCKeditor->Config['EnterMode'] = 'br'; // turn off auto <p> tags wrapping content

I prefer the latter way because you can do it on a page by page basis, and there’s no messing with FCK’s core JavaScript files.

3 responses to “FCKEditor: Remove & prevent <p> tags from wrapping your content.”

  1. Excellent tip for replacing with

    no need to change any .js file

    really worth …’

  2. Bilf says:


  3. Petey Knox says:

    $oFCKeditor->Config[‘EnterMode’] = `br`; // turn off auto tags wrapping content

    tyldę tam trzeba dać `br`
    u góry jest bład , a tylda działa 🙂