Skip to content

Commit 2b405de

Browse files
jehervekraftbj
authored andcommitted
[not verified] Top Posts Widget: provide defaults for newly added param. (#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.
1 parent 71e202b commit 2b405de

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

modules/widgets/top-posts.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,12 +525,15 @@ public function get_by_likes( $count, $types = array( 'post', 'page' ) ) {
525525
/**
526526
* Get the top posts based on views
527527
*
528+
* @since 8.4.0 Added $types param
529+
*
528530
* @param int $count The maximum number of posts to be returned.
529531
* @param array $args The widget arguments.
530532
* @param array $types The post types that should be returned.
531-
* @return array array of posts.
533+
*
534+
* @return array array of posts. Defaults to 'post' and 'page'.
532535
*/
533-
public function get_by_views( $count, $args, $types ) {
536+
public function get_by_views( $count, $args, $types = array( 'post', 'page' ) ) {
534537
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
535538
global $wpdb;
536539

0 commit comments

Comments
 (0)