diff --git a/class.jetpack.php b/class.jetpack.php index 04f5623c08e..b6aa3af358f 100644 --- a/class.jetpack.php +++ b/class.jetpack.php @@ -6521,6 +6521,7 @@ public function deprecated_hooks() { 'atd_http_post_timeout' => null, 'atd_http_post_error' => null, 'atd_service_domain' => null, + 'jetpack_widget_authors_exclude' => 'jetpack_widget_authors_params', ); // This is a silly loop depth. Better way? diff --git a/modules/widgets/authors.php b/modules/widgets/authors.php index dfc7865285f..f365c3b1a0e 100644 --- a/modules/widgets/authors.php +++ b/modules/widgets/authors.php @@ -78,26 +78,41 @@ public function widget( $args, $instance ) { // We need to query at least one post to determine whether an author has written any posts or not $query_number = max( $instance['number'], 1 ); - $default_excluded_authors = array(); /** * Filter authors from the Widget Authors widget. * * @module widgets * + * @deprecated 7.7.0 Use jetpack_widget_authors_params instead. + * * @since 4.5.0 * * @param array $default_excluded_authors Array of user ID's that will be excluded */ - $excluded_authors = apply_filters( 'jetpack_widget_authors_exclude', $default_excluded_authors ); + $excluded_authors = apply_filters( 'jetpack_widget_authors_exclude', array() ); - $authors = get_users( + /** + * Filter the parameters of `get_users` call in the Widget Authors widget. + * + * See the following for `get_users` default arguments: + * https://codex.wordpress.org/Function_Reference/get_users + * + * @module widgets + * + * @since 7.7.0 + * + * @param array $get_author_params Array of params used in `get_user` + */ + $get_author_params = apply_filters( + 'jetpack_widget_authors_params', array( - 'fields' => 'all', 'who' => 'authors', 'exclude' => (array) $excluded_authors, ) ); + $authors = get_users( $get_author_params ); + echo $args['before_widget']; /** This filter is documented in core/src/wp-includes/default-widgets.php */ $title = apply_filters( 'widget_title', $instance['title'] );