-
Notifications
You must be signed in to change notification settings - Fork 9
mastodon_api_public_timeline
github-actions[bot] edited this page Jul 24, 2026
·
31 revisions
Modify the public timelines data returned for /api/timelines/(public) requests.
add_filter( 'mastodon_api_public_timeline', function( $statuses, $request ) {
$args = array( 'post_status' => 'publish' );
$posts = get_posts( $args );
$statuses = array();
foreach ( $posts as $post ) {
$statuses[] = apply_filters( 'mastodon_api_status', null, $post->ID, array() );
}
return new WP_REST_Response( array_filter( $statuses ) );
}, 10, 2 );-
WP_REST_Response|null$statusesThe statuses data. -
WP_REST_Request$requestThe request object.
WP_REST_Response The modified statuses data.
\apply_filters( 'mastodon_api_public_timeline', null, $request )