WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#8962 closed defect (bug) (duplicate)

get_shortcode_regex probrem

Reported by: smilkobuta Owned by:
Milestone: Priority: high
Severity: normal Version: 2.7
Component: General Keywords:
Focuses: 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 (3)

comment:1 @mrmist7 years ago

  • Version set to 2.7

See #8553 and related.

comment:2 @Denis-de-Bernardy7 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

comment:3 @mrmist7 years ago

  • Milestone 2.7.1 deleted
Note: See TracTickets for help on using tickets.