| Conditions | 8 |
| Paths | 10 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public static function remove(string $hook, string $class, string $method) { |
||
| 22 | $filters = []; |
||
| 23 | if (array_key_exists($hook, $GLOBALS['wp_filter']) === true) { |
||
| 24 | $filters = $GLOBALS['wp_filter'][$hook]; |
||
| 25 | } |
||
| 26 | if (empty($filters) === true) { |
||
| 27 | return; |
||
| 28 | } |
||
| 29 | |||
| 30 | foreach ($filters as $priority => $filter) { |
||
| 31 | foreach ($filter as $function) { |
||
| 32 | if (is_array($function) === true |
||
| 33 | && is_a($function['function'][0], $class) === true |
||
| 34 | && $method === $function['function'][1] |
||
| 35 | ) { |
||
| 36 | remove_filter( |
||
| 37 | $hook, |
||
| 38 | [ |
||
| 39 | $function['function'][0], |
||
| 40 | $method, |
||
| 41 | ], |
||
| 42 | $priority |
||
| 43 | ); |
||
| 49 |