@@ -39,7 +39,7 @@ private function __construct() {
39
39
add_action ( 'rest_api_init ' , array ( $ this , 'register_like_api ' ) );
40
40
}
41
41
42
- add_action ( 'admin_init ' , array ( $ this , 'init ' ) );
42
+ add_action ( 'current_screen ' , array ( $ this , 'init ' ) );
43
43
}
44
44
45
45
/**
@@ -63,11 +63,18 @@ public function init() {
63
63
return ;
64
64
}
65
65
66
- if ( is_admin () ) {
67
- add_filter ( 'comment_class ' , array ( $ this , 'add_like_class ' ), 10 , 3 );
68
- add_filter ( 'comment_row_actions ' , array ( $ this , 'enable_likes ' ), 10 , 2 );
69
- add_action ( 'admin_enqueue_scripts ' , array ( $ this , 'enqueue_scripts ' ), 10 , 2 );
66
+ if ( ! is_admin () ) {
67
+ return ;
70
68
}
69
+
70
+ $ screen = get_current_screen ();
71
+ if ( ! $ screen || 'edit-comments ' !== $ screen ->id ) {
72
+ return ;
73
+ }
74
+
75
+ add_filter ( 'comment_class ' , array ( $ this , 'add_like_class ' ), 10 , 3 );
76
+ add_filter ( 'comment_row_actions ' , array ( $ this , 'enable_likes ' ), 10 , 2 );
77
+ add_action ( 'admin_enqueue_scripts ' , array ( $ this , 'enqueue_scripts ' ), 10 , 2 );
71
78
}
72
79
73
80
/**
0 commit comments