[wp-trac] [WordPress Trac] #56993: I want to put a filter in the wp_enqueue_block_support_styles function.

WordPress Trac noreply at wordpress.org
Fri Nov 4 06:26:36 UTC 2022


#56993: I want to put a filter in the wp_enqueue_block_support_styles function.
-----------------------------+------------------------------
 Reporter:  nendeb55         |       Owner:  (none)
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  General          |     Version:  6.1
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by nendeb55):

 For example.

 {{{#!php
 <?php
 function wp_enqueue_block_support_styles( $style, $priority = 10 ) {
         $action_hook_name = 'wp_footer';
         if ( wp_is_block_theme() ) {
                 $action_hook_name = 'wp_head';
         }

         //Add Filter
         $action_hook_name = apply_filters(
 'wp_enqueue_block_support_styles_action_hook_name', $action_hook_name );

         add_action(
                 $action_hook_name,
                 static function () use ( $style ) {
                         echo "<style>$style</style>\n";
                 },
                 $priority
         );
 }
 }}}

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


More information about the wp-trac mailing list