Skip to content

Commit

Permalink
Added jetpack_widget_authors_exclude to the deprecated hooks list a…
Browse files Browse the repository at this point in the history
…nd added the deprecated notice to the docblock. Other minor changes to make the parsers happy. Feedback thanks to @jeherve.
  • Loading branch information
Tim Moore committed Aug 1, 2019
1 parent 5f4d700 commit c3e81ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions class.jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
12 changes: 7 additions & 5 deletions modules/widgets/authors.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,18 @@ 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() );

/**
* Filter the parameters of `get_users` call in the Widget Authors widget.
Expand All @@ -98,11 +99,12 @@ public function widget( $args, $instance ) {
*
* @module widgets
*
* @since 7.6.0
* @since 7.7.0
*
* @param array Array of params used in `get_user`
* @param array $get_author_params Array of params used in `get_user`
*/
$get_author_params = apply_filters( 'jetpack_widget_authors_params',
$get_author_params = apply_filters(
'jetpack_widget_authors_params',
array(
'who' => 'authors',
'exclude' => (array) $excluded_authors,
Expand Down

0 comments on commit c3e81ae

Please sign in to comment.