Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#19484 closed defect (bug) (duplicate)

Shortcode skipping when using two different types for same keyword.

Reported by: raguay Owned by: raguay
Milestone: Priority: normal
Severity: normal Version: 2.8
Component: Shortcodes Keywords:
Focuses: Cc:


I am writing a shortcode that has an open and closed format. What I mean by that is: open format is when you use a short code to open and close the content. Example: "[highlight lang='HTML'] <some html> [/highlight]". Closed format is when you just use the shortcode without incorporating anything else. Example: "[highlight lang='HTML' name='test']" and it pulls the named script from the html database for highlighting. If you only use one format in a page, it does fine. But when you mix them, it does not properly work. For example:

[highlight lang='HTML' name='test']

<some html>

[highlight lang='HTML']

<some html to be highlighted>


The above example will always remove any content from the first shortcode to the closure shortcode thinking that the closure is for the first shortcode only. The shortcode code should reset with the second shortcode defined and assume the first one does not have a closure shortcode. If you reverse the order of the shortcodes, it will work fine, but that is not always the usage case.

I have test this in 2.8 through 3.3 rc1. I also could not find anything like this reported in the existing tickets. Most likely no one has tried to do anything like this before. I guess I could make it more than one shortcode, but I like the flexibility of the this format.

Richard Guay

Change History (3)

#1 @helenyhou
6 years ago

  • Version changed from 3.3 to 2.8

#2 @raguay
6 years ago

  • Keywords close added
  • Resolution set to duplicate
  • Status changed from new to closed

Sorry, I did not know to look in the codex and I thought I did not see it in any bug report. Since this is an old, known bug, I assume it will not be fixed soon and will make a separate shortcode.

#3 @helenyhou
6 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.