Opened 10 years ago
Closed 9 years ago
#29870 closed defect (bug) (fixed)
Pagination disappears after deleting the last page of post entries
Reported by: | Greg Raven | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 4.0 |
Component: | Posts, Post Types | Keywords: | needs-patch |
Focuses: | Cc: |
Description
If you have multiple pages of posts listed in the All Posts listing, go to the last page of the posts. Click the checkbox to select all of the posts on that page. Bulk delete your selection. After WP deletes those entries, the pagination disappears from the top of the listing pane.
If you delete all posts from other pages, when the window content refreshes the pagination will be there.
Attachments (3)
Change History (20)
#1
@
10 years ago
- Keywords needs-patch needs-codex added
- Milestone changed from Awaiting Review to Future Release
#3
@
10 years ago
This can be replicated by just appending the paged parameter with a page number greater than the total pages on the all posts screen.
#6
@
10 years ago
- Keywords needs-patch added; has-patch removed
Should look into why what's in WP_List_Table
doesn't seem to work.
#7
@
10 years ago
I'm not sure WP_List_Table
is at fault here, the issue is that the prepare_items
method in the WP_Posts_List_Table
class is not passing the correct values.
The reason for querying for the post counts separately is for performance reasons. The initial query doesn't return results because the SQL offset exceeds the amount of posts, but removing the offset will query and return all posts on every paginated page, hence the additional lookup.
#10
@
9 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Future Release to 4.4
#12
@
9 years ago
- Keywords needs-patch added; good-first-bug has-patch removed
- Resolution fixed deleted
- Status changed from closed to reopened
[34271] brokes the pagination for searches. It uses the total number of posts and not the number of search results.
#13
@
9 years ago
- Owner changed from A5hleyRich to wonderboymusic
- Status changed from reopened to assigned
@wonderboymusic Sounds like we need a follow-up re: comment:12.
#15
@
9 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
I ran into issues with this earlier today where the pagination no longer works with custom views that modify the query. The total items count used to be calculated based on $wp_query->found_posts
, so pagination correctly accounted for any changes to the query, but that's no longer the case.
I tried to find a way to fix the pagination args from outside the list table class, but it doesn't look like it's possible after [34271].
#16
@
9 years ago
I attached a new patch that continues using $wp_query->found_posts
on the first page of results or when any posts are actually found, otherwise it'll use the post counts to determine if the request is out of bounds.
I also went ahead and removed the $total_pages
calculation since that's done immediately in WP_List_Table::set_pagination_args()
.
Thanks for the report, sorry we missed this. Seems like we should check to make sure we're within the bounds of pagination and, if not, go to the last page.