shortcode - $m in pre_do_shortcode_tag

admin2025-05-31  0

What is the $m parameter of pre_do_shortcode_tag?

var_dump($m) shows for example:

array(7) {
  [0]=>
  string(32) "[gallery id="123" size="medium"]"
  [1]=>
  string(0) ""
  [2]=>
  string(7) "gallery"
  [3]=>
  string(23) " id="123" size="medium""
  [4]=>
  string(0) ""
  [5]=>
  string(0) ""
  [6]=>
  string(0) ""
}

So you can say: It is array of:

  • the whole shortcode command
  • ?
  • the shortcode
  • all options and values prepended with a space character
  • ?
  • ?
  • ?

Where is it documented? Thank you very much.

What is the $m parameter of pre_do_shortcode_tag?

var_dump($m) shows for example:

array(7) {
  [0]=>
  string(32) "[gallery id="123" size="medium"]"
  [1]=>
  string(0) ""
  [2]=>
  string(7) "gallery"
  [3]=>
  string(23) " id="123" size="medium""
  [4]=>
  string(0) ""
  [5]=>
  string(0) ""
  [6]=>
  string(0) ""
}

So you can say: It is array of:

  • the whole shortcode command
  • ?
  • the shortcode
  • all options and values prepended with a space character
  • ?
  • ?
  • ?

Where is it documented? Thank you very much.

Share Improve this question asked Apr 24 at 6:22 pehupehu 235 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

The documentation for $m is available in the function that the pre_do_shortcode_tag filter gets called in, do_shortcode_tag():

/**
 * …
 * @param array $m {
 *     Regular expression match array.
 * 
 *     @type string $0 Entire matched shortcode text.
 *     @type string $1 Optional second opening bracket for escaping shortcodes.
 *     @type string $2 Shortcode name.
 *     @type string $3 Shortcode arguments list.
 *     @type string $4 Optional self closing slash.
 *     @type string $5 Content of a shortcode when it wraps some content.
 *     @type string $6 Optional second closing bracket for escaping shortcodes.
 * }
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748638877a313704.html

最新回复(0)