[wp-trac] [WordPress Trac] #28030: cast $content as a string when calling do_shortcode()

WordPress Trac noreply at wordpress.org
Fri Apr 25 18:29:39 UTC 2014

#28030: cast $content as a string when calling do_shortcode()
 Reporter:  webstract     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Shortcodes    |     Version:  3.9
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:

Comment (by webstract):

 There are numerous people getting this errors from themes and plugins...

 In my case it was this function. `$atts` is an array but gets passed to
 `make_more_shortcodes($atts)` which runs `do_shortcode()` - this was
 created for nested shortcodes.
 add_shortcode('action', 'sc_action');
 function sc_action($atts, $content=null) {
         $atts = make_more_shortcodes($atts);
                 'name' => 'scroll_form',
                 'text' => 'click here to schedule'
         ), $atts));

         if($name == 'scroll_form') $anchor = '#bigOffer';

         return '<a href="'.$anchor.'">'.$text.'</a>';

Ticket URL: <https://core.trac.wordpress.org/ticket/28030#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list