[wp-trac] [WordPress Trac] #25415: magically (improperly!) inserted P tag
WordPress Trac
noreply at wordpress.org
Wed Sep 25 11:32:23 UTC 2013
#25415: magically (improperly!) inserted P tag
--------------------------+-----------------------------
Reporter: crysman | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.6.1
Severity: major | Keywords:
--------------------------+-----------------------------
I've encountered an interresting bug today, which occurs whenever you
insert more than one shortcode in the edit page admin interface.
I've been using latest WP (3.6.1), standard twenty-thirteen template and
have disabled all plugins except for this one I am using for testing:
{{{
<?php
/*
Plugin Name: test shortcode
Description: just a simple shortcode test
*/
function testshortcode() {
return 'SUCCESS!';
}
add_shortcode('testshortcode', 'testshortcode');
?>
}}}
Now try these 4 variants in the Edit page admin interface:
1)
{{{
[testshortcode]
}}}
2)
{{{
[testshortcode][testshortcode]
}}}
3)
{{{
[testshortcode]
[testshortcode]
}}}
4)
{{{
[testshortcode]
[testshortcode]
}}}
Examples 2 and 3 will magically (and '''improperly'''!) wrap the output of
the shortcode to P tag!
Let's look into the HTML source of the published page (all whitespace has
been preserved):
1)
{{{
</header><!-- .entry-header -->
<div class="entry-content">
SUCCESS!
</div><!-- .entry-content -->
<footer class="entry-meta">
}}}
2)
{{{
</header><!-- .entry-header -->
<div class="entry-content">
<p>SUCCESS!SUCCESS!</p>
</div><!-- .entry-content -->
<footer class="entry-meta">
}}}
3)
{{{
</header><!-- .entry-header -->
<div class="entry-content">
<p>SUCCESS!<br />
SUCCESS!</p>
</div><!-- .entry-content -->
<footer class="entry-meta">
}}}
4)
{{{
</header><!-- .entry-header -->
<div class="entry-content">
SUCCESS!
SUCCESS!
</div><!-- .entry-content -->
<footer class="entry-meta">
}}}
Both examples 2 and 3 are wrong, because there is the P tag wrapping added
out of nowhere...
Shortcodes should be not wrapped in P or anything. If I wanted it wrapped,
I would do it myself...
'''This makes some of our pages INVALID HTML, and should certainly be
fixed'''.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/25415>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list