Make WordPress Core

Opened 17 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:

Description

Hoping this is similar to this already fixed issue:
http://trac.wordpress.org/ticket/2833

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

Wordpress forum discussion:
http://wordpress.org/support/topic/83375

Attachments (1)

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

Download all attachments as: .zip

Change History (7)

#1 @_ck_
17 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
17 years ago

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

http://comox.textdrive.com/pipermail/wp-hackers/2006-August/thread.html

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
17 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.

@Nazgul
17 years ago

#4 @Nazgul
17 years ago

  • Keywords has-patch added

Created a patch based on the given suggestions.

#5 @Nazgul
17 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.