DeregisterEntityScripts.php
29 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\ThirdPartyCompatibility\Divi; |
| 4 | |
| 5 | /** |
| 6 | * @since 4.13.0 include divi options page |
| 7 | * @since 4.5.0 |
| 8 | */ |
| 9 | class DeregisterEntityScripts |
| 10 | { |
| 11 | public function __invoke() |
| 12 | { |
| 13 | if ( ! isset($_GET['page']) || ! in_array($_GET['page'], ['et_theme_builder', 'et_divi_options'])) { |
| 14 | return; |
| 15 | } |
| 16 | |
| 17 | global $wp_scripts; |
| 18 | |
| 19 | $registered_scripts = $wp_scripts->registered; |
| 20 | |
| 21 | foreach ($registered_scripts as $handle => $script) { |
| 22 | if (preg_match('/^givewp-.*-entity$/', $handle)) { |
| 23 | wp_dequeue_script($handle); |
| 24 | wp_deregister_script($handle); |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | } |
| 29 |