WordPress.org

Make WordPress Core

Opened 9 months ago

Closed 4 months ago

#24781 closed enhancement (wontfix)

Deprecate the_weekday() and the_weekday_date()

Reported by: DrewAPicture Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Date/Time Keywords: has-patch
Focuses: Cc:

Description

We should deprecate the_weekday() and the_weekday_date(). Both are original b2 functions that even before WordPress 0.71 were marked obsolete in the readme. They're also not used in core.

A search of the plugins repo returned eight code editor plugins and one unit testing plugin, so it might be safe to remove them after 10+ years.

Each contain a like-named filter.

Attachments (1)

24781.diff (3.0 KB) - added by DrewAPicture 9 months ago.

Download all attachments as: .zip

Change History (7)

comment:1 follow-up: nacin9 months ago

the_weekday_date() was partially broken until a change in 3.6 to declare a referenced global.

DrewAPicture9 months ago

comment:2 in reply to: ↑ 1 ; follow-up: rmccue9 months ago

Replying to nacin:

the_weekday_date() was partially broken until a change in 3.6 to declare a referenced global.

Given this, deprecation sounds like it won't break anything. That said, I'd expect this is used more in themes than plugins, so checking plugins is probably not a good indication of use.

comment:3 in reply to: ↑ 2 nacin9 months ago

Replying to rmccue:

I'd expect this is used more in themes than plugins, so checking plugins is probably not a good indication of use.

Indeed, especially older themes. This is a template tag; like many template tags, they aren't going to be directly used by core.

comment:4 follow-up: DrewAPicture9 months ago

At first glance, I thought they were the only way to retrieve the localized day names because they use WP_Local::get_weekday().

Turns out the $translate parameter in mysql2date() defaults to true, which means get_the_date() and in turn the_date() output localized values. Therefore the_weekday() is the same as the_date( 'l' ).

On that same token, I'm not sure which global @nacin was referring to in the_weekday_date(), but I can't quite figure out what its purpose is in relation to the_weekday() — to not display the current post's day if it's different from the previous one? Is that the previous post's day? Why?

Version 0, edited 9 months ago by DrewAPicture (next)

comment:5 in reply to: ↑ 4 SergeyBiryukov9 months ago

Replying to DrewAPicture:

Turns out the $translate parameter in mysql2date() defaults to true, which means get_the_date() and in turn the_date() output localized values.

Correct, also noted in ticket:23918:6.

On that same token, I'm not sure which global @nacin was referring to in the_weekday_date(),

$currentday, see [24189].

but I can't quite figure out what its purpose is in relation to the_weekday() — to not display the current post's day if it's different from the previous one? Is that the previous post's day? Why?

As stated in the inline docs, the_weekday_date() only displays the weekday if the current post's weekday is different from the previous output. Looks like the idea is the same as in the_date() vs. the_time().

comment:6 DrewAPicture4 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
  • Type changed from defect (bug) to enhancement

Sounds like we're gonna keep 'em.

Note: See TracTickets for help on using tickets.