Make WordPress Core

Opened 12 years ago

Closed 9 years ago

Last modified 9 years ago

#21015 closed defect (bug) (fixed)

Months dropdown should not show if only posts are 'auto-draft' status

Reported by: coenjacobs's profile CoenJacobs Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version: 3.1
Component: Posts, Post Types Keywords: has-patch needs-screenshots
Focuses: administration Cc:

Description

The months dropdown at the top of edit.php should only show if there are actually posts in the list.

Right now, if you click 'Add new' an auto draft post will be saved. Leave the post edit screen without saving the post (so no draft will be created) and go back to the edit.php screen. There is no post in the list, but the month drop down will be shown because the auto draft is counted.

Attachments (6)

21015.diff (471 bytes) - added by CoenJacobs 12 years ago.
Filters out the posts with 'auto-draft' as status in counting query
21015.2.diff (503 bytes) - added by MikeHansenMe 12 years ago.
filters trash status as well.
21015.3.patch (745 bytes) - added by MikeHansenMe 12 years ago.
21015.4.patch (846 bytes) - added by CoenJacobs 12 years ago.
21015.5.patch (775 bytes) - added by CoenJacobs 11 years ago.
Revised patch, tested against current trunk
21015.6.diff (732 bytes) - added by MikeHansenMe 9 years ago.
Refreshed for 4.3

Download all attachments as: .zip

Change History (22)

@CoenJacobs
12 years ago

Filters out the posts with 'auto-draft' as status in counting query

@MikeHansenMe
12 years ago

filters trash status as well.

#1 @MikeHansenMe
12 years ago

  • Cc MikeHansenMe added

While testing this patch I realized that it was also showing dates of posts that had been deleted or 'trash' status. I updated the file to prevent both.

#2 @MikeHansenMe
12 years ago

  • Keywords needs-testing added

Just realized my patch was removing dates from the trash link above the posts. I updated to allow dates for trash posts for trash status only.

#3 @CoenJacobs
12 years ago

After testing your patch, I found out that it needs to check for the $_GET variable to be set to prevent notices. Patched that, done some testing with it. Looks good to me now.

Last edited 12 years ago by CoenJacobs (previous) (diff)

@CoenJacobs
12 years ago

#4 @MikeHansenMe
12 years ago

Looks good

#5 @SergeyBiryukov
12 years ago

#22033 was marked as a duplicate.

@CoenJacobs
11 years ago

Revised patch, tested against current trunk

#6 @CoenJacobs
11 years ago

Tested this again against current trunk and made a small adjustment (no use checking for $_GET['post_status'] twice, it's there or it's not). This needs a second set of eyes to test.

Last edited 11 years ago by CoenJacobs (previous) (diff)

#7 @rmarks
11 years ago

  • Cc rmarks@… added

#8 @jeremyfelt
10 years ago

  • Component changed from Administration to Posts, Post Types
  • Focuses admin added

#9 @seanchayes
10 years ago

I emulated the issue with both Posts and Pages. Without the 21015.5 patch applied I saw that the additional month was in the dropdown even though no associated post/page showed in the All Posts/Pages list.

I applied the 21015.5 patch and repeated the exercise and found that only the month(s) with relevant / actively created content showed in the dropdown.

I also added a register_post_type call for "Listings" in my _s theme to generate a custom post type. I observed the same behavior as above in the all "Listings" view edit.php?post_type=listing before and after the patch was applied.

#10 @samuelsidler
10 years ago

  • Keywords needs-testing removed

@MikeHansenMe
9 years ago

Refreshed for 4.3

#11 @swissspidy
9 years ago

  • Milestone changed from Awaiting Review to 4.4

Latest patch still applies and works. Can we get this into 4.4?

#12 follow-up: @jorbin
9 years ago

Wouldn't it also make sense to hide the other two dropdowns as well? You can't do any bulk actions to non existant posts and you can't filter by categories if there are no posts.

#13 in reply to: ↑ 12 @swissspidy
9 years ago

Replying to jorbin:

Wouldn't it also make sense to hide the other two dropdowns as well? You can't do any bulk actions to non existant posts and you can't filter by categories if there are no posts.

There's #21856 for the category dropdown and I just created #33824 for the bulk actions dropdown

#14 @wonderboymusic
9 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 34076:

List Tables: don't render "extra tablenav" if there are no posts. This includes Bulk Actions, Dates Dropdown, Category Dropdowns, Pagination.

Also ensure that the Months dropdown, when it is shown, shows months from the proper set of posts.

Props egower, CoenJacobs, MikeHansenMe, mehulkaklotar.
Fixes #33824, #21015, #21856.

#15 @wonderboymusic
9 years ago

In 34077:

After [34076], fix the logic for post_status in months dropdown.

See #21015.

#16 @ryan
9 years ago

  • Keywords needs-screenshots added
Note: See TracTickets for help on using tickets.