Make WordPress Core

Opened 18 years ago

Closed 17 years ago

#3035 closed defect (bug) (fixed)

wpautop breaks object tags

Reported by: bwooster47's profile bwooster47 Owned by:
Milestone: 2.1 Priority: normal
Severity: normal Version: 2.0.4
Component: General Keywords: wpautop breaks object embed has-patch
Focuses: Cc:


Hoping this is similar to this already fixed issue:

br tags are being inserted in <object...> </object> tags, and <embed /> tags (which is normally inside the object tag).

Wordpress forum discussion:

Attachments (1)

3035.diff (3.7 KB) - added by Nazgul 18 years ago.

Download all attachments as: .zip

Change History (7)

#1 @_ck_
18 years ago

Use the Text Control plugin 2.0b2 with my little fix documented here

You can then turn off wptexturize for individual posts which will fix the formatting for embed and objects (and script and other tags like that).

#2 @Viper007Bond
18 years ago

Yeah, I had to hack around this to fix this for a plugin I made.

Ended up changing my function's priority to 11 (after wpautop) and moving wptexturize after my plugin (since it'd screw up my BBcode).

#3 @Tjworld
18 years ago

This is a bug of sorts in wpautop() in the file /wp-includes/functions-formatting.php

I patched to to work for Google Video embedded Flash player tags.

The simple fix is as follows:

In function wpautop($pee, $br = 1) {

Add "object|" to three of the regular expressions.

The expressions are the first two that begin:

$pee = preg_replace('!(<(?:table|thead|tfoot|

which, after inserting "object|" before "table" become:

$pee = preg_replace('!(<(?:object|table|thead|tfoot|

Next, find the line that begins:

if ($br) $pee = preg_replace(

And on the following line:

$pee = preg_replace('!(</?(?:table|thead|

insert "object|" before "table" so it becomes:

$pee = preg_replace('!(</?(?:object|table|thead|

You can apply the same principle to some other tags that are mangled by the auto-formatting.

18 years ago

#4 @Nazgul
18 years ago

  • Keywords has-patch added

Created a patch based on the given suggestions.

#5 @Nazgul
18 years ago

  • Milestone set to 2.1
  • Version set to 2.0.4

#6 @matt
17 years ago

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

This seems to work fine in trunk.

Note: See TracTickets for help on using tickets.