[wp-trac] [WordPress Trac] #10457: Parse shortcodes in text widgets by default

WordPress Trac noreply at wordpress.org
Tue Nov 14 16:01:48 UTC 2017


#10457: Parse shortcodes in text widgets by default
-------------------------------------------------+-------------------------
 Reporter:  ionfish                              |       Owner:
     Type:  enhancement                          |  westonruter
 Priority:  normal                               |      Status:  reopened
Component:  Widgets                              |   Milestone:  4.9
 Severity:  normal                               |     Version:  2.8
 Keywords:  westi-likes has-patch commit has-    |  Resolution:
  unit-tests has-dev-note                        |     Focuses:
-------------------------------------------------+-------------------------

Comment (by bobbingwide):

 Replying to [comment:65 westonruter]:
 > Core does not apply shortcodes in the Custom HTML widget at all.

 Does that make sense? Should that not have been part of the
 implementation?

 > Do you have a plugin that adds shortcode processing to the `widget_text`
 filter?

 I certainly do. And I didn't need to change it for 4.8 since the
 do_shortcode logic was enable just in time because of my existing filter.
 It's called oik.


 > Instance, if you add a `[gallery]` shortcode without any arguments, in a
 post context it will grab all of the attachments of the current post.

 Yes, exactly. Had I done that in my shortcode enabled text widget then
 that's what gallery would have done.
 So now 4.9 would break it.

 > So it's up to the plugin developer and the user to use the shortcodes in
 their appropriate context.
 My shortcodes need to be able to obtain the post ID in order to determine
 the context. If you hide it I'll have to dig further into core to save the
 value I need for later.

 > I suggest we open a ticket for 4.9.1 that adds nullification of the
 `$post` for the Custom HTML widget and we re-close this ticket.

 That could resolve the inconsistency but it means that 4.9 will be shipped
 with broken backward compatibility.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/10457#comment:66>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list