In WordPress 4.8 some changes were made to the Text widget logic to enable the Visual editor to be used. This effed up quite a few sites. A number of WordPress TRACs were raised and a number of new plugins developed to help deal with the situation. In WordPress 4.8.1, due 1st August 2017, there will be a new HTML widget. Since WordPress doesn't automatically support shortcode expansion in text widgets it seems reasonable that it might not automatically support shortcode expansion in HTML widgets.
Requirement
The requirement for oik shortcodes is that they should be expanded in HTML widgets.
Proposed solution
The current proposal ( 23 Jul 2017) for WordPress 4.8.1 is that the filters associated to widget_text be applied prior to any additional filters for widget_custom_html_content.
It should therefore NOT BE NECESSARY for the following to be added to bw_oik_add_shortcodes_loaded()
We can make an improvement though.
The balanceTags() function is only effective when the use_balanceTags option is set. Since WordPress 4.3, when the UI for this option was removed, the default for new installs is false. For installations created before 4.3, the option can still be set. There's no need to have it attached to widget_text if the option is not set so, while adjusting filter hook priorities, to ensure balanceTags is called before do_shortcode, we can test to see if it's needed at all.
This solution works. Blocks.wp-a2z.org uses Custom HTML widgets in the footer. Footer 2 contains the [guts] shortcode - from oik-block - which shows the current WordPress and Gutenberg versions.
In WordPress 4.8 some changes were made to the Text widget logic to enable the Visual editor to be used. This effed up quite a few sites. A number of WordPress TRACs were raised and a number of new plugins developed to help deal with the situation. In WordPress 4.8.1, due 1st August 2017, there will be a new HTML widget. Since WordPress doesn't automatically support shortcode expansion in text widgets it seems reasonable that it might not automatically support shortcode expansion in HTML widgets.
Requirement
The requirement for oik shortcodes is that they should be expanded in HTML widgets.
Proposed solution
The current proposal ( 23 Jul 2017) for WordPress 4.8.1 is that the filters associated to
widget_text
be applied prior to any additional filters forwidget_custom_html_content
.It should therefore NOT BE NECESSARY for the following to be added to bw_oik_add_shortcodes_loaded()
as this would invoke shortcode processing again.
We can make an improvement though. The balanceTags() function is only effective when the
use_balanceTags
option is set. Since WordPress 4.3, when the UI for this option was removed, the default for new installs is false. For installations created before 4.3, the option can still be set. There's no need to have it attached towidget_text
if the option is not set so, while adjusting filter hook priorities, to ensure balanceTags is called before do_shortcode, we can test to see if it's needed at all.Testing requirement
We also need to make sure that wpautop doesn't break things.