Ticket #8962 (closed defect (bug): duplicate)

Opened 3 years ago

Last modified 3 years ago

get_shortcode_regex probrem

Reported by: smilkobuta Owned by: anonymous
Priority: high Milestone:
Component: General Version: 2.7
Severity: normal Keywords:
Cc:

Description

Long articles is not displayed because of get_shortcode_regex function. this function is invoked by wpautop function, and maybe preg_replace can't perform a regular expression which generated in get_shortcode_regex.

This is wpauto code(there is no probrem).

    $pee = preg_replace('/<p>\s*?(' . get_shortcode_regex() . ')\s*<\/p>/s', '$1', $pee); // don't auto-p wrap shortcodes that stand alone

Here is modified code.

function get_shortcode_regex() {
	global $shortcode_tags;
	$tagnames = array_keys($shortcode_tags);
	$tagregexp = join( '|', array_map('preg_quote', $tagnames) );

//	return '\[('.$tagregexp.')\b(.*?)(?:(\/)?\](?:(.+?)\[\/\1\])?';
    return '\[('.$tagregexp.')\b([^\]]*?)(\/)?\](?:(.+?)\[\/\1\])?';
}

This modification was written by following blog.  http://www.brusdeylins.info/wordpress/probleme-mit-shortcodes/

Change History

  • Version set to 2.7

See #8553 and related.

  • Status changed from new to closed
  • Resolution set to duplicate
  • Milestone 2.7.1 deleted
Note: See TracTickets for help on using tickets.