Register admin filters only on admin requests.
This commit is contained in:
parent
73228a59ed
commit
6464d8d60d
|
@ -94,6 +94,7 @@ class HooksRegistry {
|
||||||
call_user_func_array( 'add_filter', $filter );
|
call_user_func_array( 'add_filter', $filter );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( is_admin() ) {
|
||||||
foreach ( self::$admin_actions as $action ) {
|
foreach ( self::$admin_actions as $action ) {
|
||||||
call_user_func_array( 'add_action', $action );
|
call_user_func_array( 'add_action', $action );
|
||||||
}
|
}
|
||||||
|
@ -101,6 +102,7 @@ class HooksRegistry {
|
||||||
foreach ( self::$admin_filters as $filter ) {
|
foreach ( self::$admin_filters as $filter ) {
|
||||||
call_user_func_array( 'add_filter', $filter );
|
call_user_func_array( 'add_filter', $filter );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ( self::$frontend_actions as $action ) {
|
foreach ( self::$frontend_actions as $action ) {
|
||||||
call_user_func_array( 'add_action', $action );
|
call_user_func_array( 'add_action', $action );
|
||||||
|
@ -115,6 +117,7 @@ class HooksRegistry {
|
||||||
* DANGEROUS: This method is used for testing and benchmarking. Do not call, unless you really know what you are doing.
|
* DANGEROUS: This method is used for testing and benchmarking. Do not call, unless you really know what you are doing.
|
||||||
*/
|
*/
|
||||||
public static function unload_hooks() {
|
public static function unload_hooks() {
|
||||||
|
if ( is_admin() ) {
|
||||||
foreach ( self::$admin_actions as $action ) {
|
foreach ( self::$admin_actions as $action ) {
|
||||||
call_user_func_array( 'remove_action', $action );
|
call_user_func_array( 'remove_action', $action );
|
||||||
}
|
}
|
||||||
|
@ -122,6 +125,8 @@ class HooksRegistry {
|
||||||
foreach ( self::$admin_filters as $filter ) {
|
foreach ( self::$admin_filters as $filter ) {
|
||||||
call_user_func_array( 'remove_filter', $filter );
|
call_user_func_array( 'remove_filter', $filter );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ( self::$frontend_actions as $action ) {
|
foreach ( self::$frontend_actions as $action ) {
|
||||||
call_user_func_array( 'remove_action', $action );
|
call_user_func_array( 'remove_action', $action );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue