Make WordPress Core

Opened 6 years ago

Closed 2 months ago

#12016 closed defect (bug) (wontfix)

get_calendar can output a calendar when there are no posts

Reported by: mtdewvirus Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Posts, Post Types Keywords: has-patch
Focuses: template Cc:


If a site doesn't have any posts, get_calendar isn't supposed to display a calendar. You can visit a page or have a static home page, and a calendar is displayed. The get_calendar function is looking at global $posts to determine if the site has posts but this variable can contain data from other post_types.


Attachments (2)

bmb_0005_t12016.patch (1.1 KB) - added by bumbu 6 years ago.
bmb_0006_t12016.patch (914 bytes) - added by bumbu 6 years ago.
the same with less code

Download all attachments as: .zip

Change History (12)

#1 @bumbu
6 years ago

  • Cc bmbalex@… added
  • Owner set to bumbu
  • Status changed from new to reviewing

In this patch if $pages exist, function additionally is looking if it contains at least one published post, if no it is looking into DB for this

6 years ago

the same with less code

#2 @bumbu
6 years ago

  • Keywords has-patch added; calendar removed
  • Owner bumbu deleted

#3 @dd32
6 years ago

I'm not sure i agree with this function not displaying a calender just because i'm viewing a page, or custom post_types..

Many would expect it to either

  1. Always display the latest posts as selected


  1. Display a calender based upon the selected post_type (Thats a whole can of worms however)

#4 @ryan
6 years ago

  • Milestone changed from 3.0 to 3.1

#5 @nacin
5 years ago

  • Keywords 2nd-opinion added
  • Milestone changed from Awaiting Triage to Future Release

#6 @nacin
23 months ago

  • Component changed from General to Template

#7 @nacin
22 months ago

  • Component changed from Template to Posts, Post Types
  • Focuses template added

#8 @chriscct7
2 months ago

  • Keywords dev-feedback added; 2nd-opinion removed

Isn't this a breaking change given it'd be expected the calendar would show and the change is to make it not show?

#9 @chriscct7
2 months ago

  • Keywords close added

#10 @johnbillion
2 months ago

  • Keywords dev-feedback close removed
  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.