Skip to content

Commit 5e0cb44

Browse files
authored
Extra Fields: Don't send more than 20 (#1660)
1 parent cc8042a commit 5e0cb44

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: minor
2+
Type: added
3+
4+
Author profiles will cap the amount of extra fields they return to 20, to avoid response size errors in clients.

includes/collection/class-extra-fields.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ public static function get_actor_fields( $user_id ) {
3939
$args['author'] = $user_id;
4040
}
4141

42+
// Limit to 20 fields to prevent response size issues.
43+
if ( ! is_admin() ) {
44+
/**
45+
* Filters the number of extra fields to retrieve for an ActivityPub actor.
46+
*
47+
* @param int $limit The number of extra fields to retrieve. Default 20.
48+
*/
49+
$args['posts_per_page'] = apply_filters( 'activitypub_actor_extra_fields_limit', 20 );
50+
$args['nopaging'] = false;
51+
}
52+
4253
$query = new \WP_Query( $args );
4354
$fields = $query->posts ?? array();
4455

0 commit comments

Comments
 (0)