[wp-trac] [WordPress Trac] #54941: Gutenberg is disabled but Duotone add severals SVG in front and back.

WordPress Trac noreply at wordpress.org
Tue Feb 1 15:56:44 UTC 2022


#54941: Gutenberg is disabled but Duotone add severals SVG in front and back.
---------------------------+---------------------
 Reporter:  deuxparquatre  |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  5.9.1
Component:  Editor         |     Version:  5.9
 Severity:  major          |  Resolution:
 Keywords:  needs-patch    |     Focuses:
---------------------------+---------------------

Comment (by zabatonni):

 A bit hacky way, but you can remove literally anything added using
 add_action even Closures:

 {{{#!php
 <?php
 add_action('wp_footer',function() {
         global $wp_filter;

         if(empty($wp_filter['wp_footer'][10])) return;

         foreach($wp_filter['wp_footer'][10] as $hook) {
                 if(!is_object($hook['function']) ||
 get_class($hook['function']) !== 'Closure') continue;

                 $static=(new
 ReflectionFunction($hook['function']))->getStaticVariables();

                 if(empty($static['svg'])) continue;

                 if(!str_starts_with($static['svg'],'<svg
 xmlns="http://www.w3.org/2000/svg" viewBox="0 0 0 0" ')) continue;

                 remove_action('wp_footer',$hook['function'],10);
         }
 },9);
 }}}

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


More information about the wp-trac mailing list