Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
CRAP
n/a
0 / 0
Automattic\Jetpack_Boost\Compatibility\Web_Stories\web_stories_should_defer_js
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
20
1<?php
2/**
3 * Compatibility for Web Stories
4 *
5 * @package automattic/jetpack-boost
6 */
7
8namespace Automattic\Jetpack_Boost\Compatibility\Web_Stories;
9
10/**
11 * Exclude Web Stories pages to be processed by the Render Blocking JS module.
12 *
13 * @param bool $should_defer_js default filter value.
14 */
15function web_stories_should_defer_js( $should_defer_js ) {
16    if ( class_exists( '\Google\Web_Stories\Story_Post_Type' )
17        && defined( '\Google\Web_Stories\Story_Post_Type::POST_TYPE_SLUG' )
18        && is_singular( \Google\Web_Stories\Story_Post_Type::POST_TYPE_SLUG ) ) {
19        return false;
20    }
21
22    return $should_defer_js;
23}
24
25add_filter( 'jetpack_boost_should_defer_js', __NAMESPACE__ . '\web_stories_should_defer_js' );