[wp-trac] [WordPress Trac] #28797: Shortcodes Run on Partial Match
WordPress Trac
noreply at wordpress.org
Tue Jul 8 23:05:26 UTC 2014
#28797: Shortcodes Run on Partial Match
--------------------------------+-----------------------------
Reporter: brianjohnsondesign | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Shortcodes | Version: 3.5.2
Severity: normal | Keywords:
Focuses: |
--------------------------------+-----------------------------
Note: This was on a slightly older version of WordPress, maybe it was
fixed since then, but I haven't seen anything about it.
I have a very simple custom plugin, which defines two shortcodes,
[close_out_display] and [close_out].
I was having some issues with it, and eventually realized that the
shortcode [close_out_display] would run the function tied to [close_out],
or at least parts of it. It would appear that nothing was being echoed,
but the function included some changes to user meta that were occurring.
To isolate the problem, I even removed, entirely, the function to create
the [close_out_display] function, leaving only [close_out] defined.
On a page with no other content, I added "[close_out_display]". Sure
enough, the [close_out] function still ran.
Then I tried changing the SHORTCODE definition for [close_out] to
[close_out1]. It did NOT run.
Then I changed the CONTENT of the page to be [close_14124] and it did NOT
run.
I tried various tests, and eventually came to the conclusion that as long
as the name of the function's shortcode is matched, in its entirety, as
the first characters of the shortcode in the content, it would run. For
instance, if it is defined as [close_out], then anything from
[close_out124521512] to [close_out_acasdcasfweiocen] would still run it.
I understand that shortcodes utilize variables and what not, but isn't the
first section of the shortcode, before any spaces, ALWAYS supposed to
match, exactly, the name of the shortcode? Shouldn't extra characters
cause it not to function?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28797>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list