Make WordPress Core

Opened 12 months ago

Closed 11 months ago

Last modified 6 months ago

#59136 closed defect (bug) (worksforme)

Hard limit of 3 posts enforced on Dashboard Recent Drafts

Reported by: jmarlin's profile jmarlin Owned by:
Milestone: Priority: normal
Severity: minor Version: 6.3
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

The number of posts in the Recent Drafts area of the Dashboard has a hard limit of 3. It's possible this was intentional, but it looks like some debugging that was left in place to me. If not, I'm not sure what the purpose of this limit would be as it could have also been achieved by modifying the default query parameters. I discovered this when trying to employ the associated filter like so:

<?php
// Increase number of drafts listed on dashboard
add_filter('dashboard_recent_drafts_query_args', function ($args) {
        $args['posts_per_page'] = 20;
        return $args;
});

The posts_per_page parameter has no effect in this case because of the following line in wp-admin/includes/dashboard.php
https://github.com/WordPress/WordPress/blob/6.3-branch/wp-admin/includes/dashboard.php#L659

If a max of 3 rows is desirable, I would recommend removing the array_slice line and simply modifying the default query here:
https://github.com/WordPress/WordPress/blob/6.3-branch/wp-admin/includes/dashboard.php#L623

Then users who want it can modify this query to increase the number of rows listed here. My use case is running a larger WP site with many authors. Authors may have many drafts in play at once, so it's useful to see more at a glance.

Thanks!

Attachments (2)

59136.diff (2.5 KB) - added by mayuripatel 11 months ago.
Hello ,
59136.2.diff (2.5 KB) - added by mayuripatel 11 months ago.
i have increased default 3 draft limit to 5 so now on dashboard of admin it will show 5 drafts

Download all attachments as: .zip

Change History (6)

This ticket was mentioned in PR #5030 on WordPress/wordpress-develop by @sukanta7660.


11 months ago
#1

  • Keywords has-patch added

@mayuripatel
11 months ago

Hello ,

@mayuripatel
11 months ago

i have increased default 3 draft limit to 5 so now on dashboard of admin it will show 5 drafts

#2 @mayuripatel
11 months ago

  • Resolution set to worksforme
  • Status changed from new to closed

@mayuripatel commented on PR #5030:


11 months ago
#3

Hello ,

i have applied patch and attached my diff file named 59136.diff on this ticket : https://core.trac.wordpress.org/attachment/ticket/59136/59136.diff , kindly check and review

#4 @swissspidy
6 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.