Opened 17 years ago
Closed 17 years ago
#3035 closed defect (bug) (fixed)
wpautop breaks object tags
Reported by: |
|
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)
Change History (7)
#2
@
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
@
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.
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).