WordPress.org

Make WordPress Core

Opened 22 months ago

Last modified 34 hours ago

#21015 new defect (bug)

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

Reported by: CoenJacobs Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.1
Component: Posts, Post Types Keywords: has-patch needs-testing
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 (5)

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

Download all attachments as: .zip

Change History (14)

CoenJacobs22 months ago

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

MikeHansenMe20 months ago

filters trash status as well.

comment:1 MikeHansenMe20 months 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.

comment:2 MikeHansenMe20 months 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.

MikeHansenMe20 months ago

comment:3 CoenJacobs20 months 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 20 months ago by CoenJacobs (previous) (diff)

CoenJacobs20 months ago

comment:4 MikeHansenMe20 months ago

Looks good

comment:5 SergeyBiryukov19 months ago

#22033 was marked as a duplicate.

CoenJacobs9 months ago

Revised patch, tested against current trunk

comment:6 CoenJacobs9 months 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 9 months ago by CoenJacobs (previous) (diff)

comment:7 rmarks9 months ago

  • Cc rmarks@… added

comment:8 jeremyfelt3 months ago

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

comment:9 seanchayes34 hours 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.

Note: See TracTickets for help on using tickets.