Skip to Content


Adds a header for HTTP2 Server Push if available by the server.

PHP March 30, 2021


This function runs automatically, so it is not called manually. Is this incorrect?

Additional Notes

The Service Worker Nebula option must be enabled, and the service worker file must be in the proper location (default: root directory) for this function to send the HTTP2 Server Push headers.

This function requests a server push of all enqueued local JS files.

Source File

Located in /libs/Optimization.php on line 314.

No Hooks

This function does not have any filters or actions available. Request one?
        public function scripts_http2_server_push_header(){
            if ( !$this->is_admin_page(true, true) && $this->get_option('service_worker') ){ //Exclude admin, login, and Customizer pages
                $timer_name = $this->timer('HTTP2 Server Push Header (Scripts)', 'start');
                global $wp_scripts;

                foreach ( $wp_scripts->queue as $handle ){
                    if ( wp_script_is($handle, 'registered') && !empty($wp_scripts->registered[$handle]->src) ){ //If this script is still registered (and src exists)
                        $ver = ( !empty($wp_scripts->registered[$handle]->ver) )? '?ver=' . $wp_scripts->registered[$handle]->ver : '';
                        $this->http2_server_push_file($wp_scripts->registered[$handle]->src . $ver, 'script');

                $timer_name = $this->timer($timer_name, 'end');

                ob_end_flush(); //Clear the output buffering


This function can not be short-circuited with an override filter. Request one?