Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 10
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * Enable the WebMCP origin trial in the block editors.
4 *
5 * @package automattic/jetpack-mu-wpcom
6 */
7
8namespace Automattic\Jetpack\Jetpack_Mu_Wpcom;
9
10add_action(
11    'admin_print_scripts',
12    static function () {
13        $screen = get_current_screen();
14        if ( ! $screen || ! in_array( $screen->base, array( 'post', 'site-editor' ), true ) || ! $screen->is_block_editor() ) {
15            return;
16        }
17
18        // Chrome validates the third-party token against the origin of this script.
19        wp_print_script_tag( array( 'src' => 'https://s0.wp.com/wp-content/js/webmcp-origin-trial-v1.js' ) );
20    },
21    0
22);