Skip to content

Commit

Permalink
[not verified] Top Posts Widget: provide defaults for newly added par…
Browse files Browse the repository at this point in the history
…am. (#15395)

$types was added in 8.4, but we did not add a default value when it's not provided.

See #15109 for more details.
  • Loading branch information
jeherve authored and kraftbj committed Apr 9, 2020
1 parent 71e202b commit 2b405de
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/widgets/top-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -525,12 +525,15 @@ public function get_by_likes( $count, $types = array( 'post', 'page' ) ) {
/**
* Get the top posts based on views
*
* @since 8.4.0 Added $types param
*
* @param int $count The maximum number of posts to be returned.
* @param array $args The widget arguments.
* @param array $types The post types that should be returned.
* @return array array of posts.
*
* @return array array of posts. Defaults to 'post' and 'page'.
*/
public function get_by_views( $count, $args, $types ) {
public function get_by_views( $count, $args, $types = array( 'post', 'page' ) ) {
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
global $wpdb;

Expand Down

0 comments on commit 2b405de

Please sign in to comment.