[wp-trac] [WordPress Trac] #54871: Specify which params are required in add_shortcode callback

WordPress Trac noreply at wordpress.org
Fri Jan 21 01:16:38 UTC 2022


#54871: Specify which params are required in add_shortcode callback
-------------------------+-------------------------------------------------
 Reporter:  mkarimzada   |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Shortcodes   |    Version:  5.8.3
 Severity:  trivial      |   Keywords:  needs-dev-note needs-codex needs-
  Focuses:  docs         |  docs
-------------------------+-------------------------------------------------
 Looking at the source code
 [https://github.com/WordPress/wordpress-
 develop/blob/ba943e113d3b31b121f77a2d30aebe14b047c69d/src/wp-
 includes/shortcodes.php#L57], it's not clear which parameters are required
 for add_shortcode $callback function.

 If you have any functions/methods that have required parameters after
 optional parameters, you will get a deprecation notice in PHP 8.

 {{{
 Required parameter $shortcode_tag follows optional parameter $content
 }}}

 The deprecation does not apply if there are types declared on the optional
 parameters, and the default values are null.
 [https://bugs.php.net/bug.php?id=53399]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54871>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list