Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#4667 closed defect (bug) (invalid)

Text alignment problem with TinyMCE ("style" attribute not allowed with "p" tag in kses.php)

Reported by: dreamer12345 Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.2.1
Component: TinyMCE Keywords:
Focuses: Cc:



When writing / editing a post with TinyMCE, sometimes centering a text or an image can cause TinyMCE to generate this code:

<p style="text-align: center">

But WordPress 2.2.1 (I'm working with WordPress MU 1.2.3, I suppose this bug affects both versions) does not allow the use of the attribute "style" with the "p" tag, resulting in an impossibility to change the alignment of text / image (in the case where TinyMCE chooses to use the "style" attribute to do the alignment).

I fixed this in my WordPress installation by allowing the "style" attribute with the "p" tag in the wp-includes/kses.php file.

Thank you for your attention (sorry if this bug has already been reported),


Change History (2)

#1 @Otto42
8 years ago

  • Resolution set to invalid
  • Status changed from new to closed

This is not a bug, it's intentional. Styles are not allowed for users without the unfiltered_html capability because they could use position:absolute styles and such and overwrite other elements of the page. Allowing style attributes is, in essence, a security risk.

Now, if you have the unfiltered_html capability (as the admin user should), then you can add style attributes all you like. kses does not get invoked for users with unfiltered_html.

#2 @foolswisdom
8 years ago

  • Milestone 2.2.2 deleted
Note: See TracTickets for help on using tickets.