@@ -21,6 +21,8 @@ class Jetpack {
21
21
*/
22
22
public static function init () {
23
23
\add_filter ( 'jetpack_sync_post_meta_whitelist ' , array ( self ::class, 'add_sync_meta ' ) );
24
+ \add_filter ( 'jetpack_sync_comment_meta_whitelist ' , array ( self ::class, 'add_sync_comment_meta ' ) );
25
+ \add_filter ( 'jetpack_sync_whitelisted_comment_types ' , array ( self ::class, 'add_comment_types ' ) );
24
26
\add_filter ( 'jetpack_json_api_comment_types ' , array ( self ::class, 'add_comment_types ' ) );
25
27
\add_filter ( 'jetpack_api_include_comment_types_count ' , array ( self ::class, 'add_comment_types ' ) );
26
28
}
@@ -39,13 +41,31 @@ public static function add_sync_meta( $allow_list ) {
39
41
return $ allow_list ;
40
42
}
41
43
44
+ /**
45
+ * Add ActivityPub comment meta keys to the Jetpack sync allow list.
46
+ *
47
+ * @param array $allow_list The Jetpack sync allow list.
48
+ *
49
+ * @return array The Jetpack sync allow list with ActivityPub comment meta keys.
50
+ */
51
+ public static function add_sync_comment_meta ( $ allow_list ) {
52
+ $ allow_list [] = 'avatar_url ' ;
53
+
54
+ return $ allow_list ;
55
+ }
56
+
42
57
/**
43
58
* Add custom comment types to the list of comment types.
44
59
*
45
60
* @param array $comment_types Default comment types.
46
61
* @return array
47
62
*/
48
63
public static function add_comment_types ( $ comment_types ) {
64
+ // jetpack_sync_whitelisted_comment_types runs on plugins_loaded, before comment types are registered.
65
+ if ( 'jetpack_sync_whitelisted_comment_types ' === current_filter () ) {
66
+ Comment::register_comment_types ();
67
+ }
68
+
49
69
return array_unique ( \array_merge ( $ comment_types , Comment::get_comment_type_slugs () ) );
50
70
}
51
71
}
0 commit comments