Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
CRAP
n/a
0 / 0
wpcom_themes_remove_wpcom_actions
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * WordPress.com Theme Fixes
4 *
5 * Various fixes to WordPress themes page related to WordPress.com.
6 *
7 * @package automattic/jetpack-mu-wpcom
8 */
9
10use Automattic\Jetpack\Jetpack_Mu_Wpcom;
11
12/**
13 * Removes actions from the active theme details added by Core to replicate our custom WP.com submenus.
14 *
15 * Core expect the menus to link to WP Admin, but our submenus point to wordpress.com so the actions won't work.
16 *
17 * @see https://github.com/WordPress/wordpress-develop/blob/80096ddf29d3ffa4d5654f5f788df7f598b48756/src/wp-admin/themes.php#L356-L412
18 */
19function wpcom_themes_remove_wpcom_actions() {
20    wp_enqueue_script(
21        'wpcom-theme-actions',
22        plugins_url( 'js/theme-actions.js', __FILE__ ),
23        array(),
24        Jetpack_Mu_Wpcom::PACKAGE_VERSION,
25        array(
26            'strategy'  => 'defer',
27            'in_footer' => true,
28        )
29    );
30}
31add_action( 'load-themes.php', 'wpcom_themes_remove_wpcom_actions' );