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

WordPress Trac noreply at wordpress.org
Mon Nov 13 15:36:51 UTC 2017


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

Comment (by bobbingwide):

 Re: https://make.wordpress.org/core/2017/10/24/widget-improvements-in-
 wordpress-4-9/
 Here are some notes for those people who don't want to short-circuit when
 $post is null.

 I have a number of shortcodes which adjust their behaviour depending on
 the values in `$GLOBALS['post']`. With 4.9-RC2, when these shortcodes are
 run in unchanged text widgets, they produce the wrong result.

 I found that I needed to extend my code a little.

 When looking for the global post id look in `$GLOBALS['post']` first. If
 not set try `$GLOBALS['id']`.

 When looking for the global post type, again look in `$GLOBALS['post']`.
 If not available and `$GLOBALS['id']` is set then call `get_post(
 $GLOBALS['id'] )` and return the post_type from the reloaded post.


 I understand that this problem does not occur with the Custom HTML widget.
 I may use the Custom HTML widget in the future but since that requires
 more effort than simply updating a plugin it was not my first option.

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


More information about the wp-trac mailing list