Opened 42 hours ago
Last modified 34 hours ago
#65317 new defect (bug)
Removal of HTML5 script theme support affects older theme gallery layout in frontend
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | 7.0 |
| Component: | Script Loader | Keywords: | close |
| Focuses: | Cc: |
Description
This is a follow-up to #64442.
On a website with older theme Renkon 1.0.9 from ElmaStudio the WordPress gallery shortcode causes layout issues after WordPress 7.0 update.
Reason is the removal of gallery shortcode inline CSS by the theme which does not work any more due to missing type attribute in WordPress 7.0 $gallery_style code:
/*-----------------------------------------------------------------------------------*/
/* Remove inline styles printed when the gallery shortcode is used.
/*-----------------------------------------------------------------------------------*/
function renkon_remove_gallery_css( $css ) {
return preg_replace( "#<style type=\"text/css\">(.*?)</style>#s", '', $css );
}
add_filter( 'gallery_style', 'renkon_remove_gallery_css' );
Out hotfix was updating the older theme code, so their filter works again.
Note: See
TracTickets for help on using
tickets.
WordPress 3.1 introduced a more reliable filter than
gallery_stylefor removing thestyletag completely.Twenty Ten has both filters, keeping
gallery_stylefor backward compatibility with WordPress 3.0.Several other themes in the directory have a
gallery_stylefilter, and most of them replace<style type='text/css'>(.*?)</style>. If they do not also have theuse_default_gallery_stylehook, I expect that those themes already had a problem in WordPress 5.3, when [46164] switched the quotes from single to double.cc: @elmastudio