#4667 closed defect (bug) (invalid)
Text alignment problem with TinyMCE ("style" attribute not allowed with "p" tag in kses.php)
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 2.2.1 |
| Component: | TinyMCE | Keywords: | |
| Focuses: | Cc: |
Description
Hi,
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),
Frederic.
Change History (2)
Note: See
TracTickets for help on using
tickets.
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.