Skip to content

WordPress visual editor strips id attributes from div tags #1

@oleonard

Description

@oleonard

With the Clear Floats Button plugin enabled in WordPress 4.3.1, if I add a <div> with an id attribute the id attribute is stripped away by the visual editor:

1. Switch to the text editor and add `<div id="foo" class="bar">text</div>`.
2. Switch to the visual editor.
3. Switch back to the text editor. The markup now looks like `<div class="bar">text</div>`.

It looks like the problem is in line 56 of clear-floats-button.php:

$init['extended_valid_elements'] = 'div[clear|style|class]';

I assume this is overwriting a default configuration which allows div[id], although I can't see where the default configuration is coming from. This plugin should at least append to the existing allowed attributes rather than overwrite them.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions