Make WordPress Core

Opened 7 years ago

Last modified 5 years ago

#40790 new enhancement

Ability to filter $post_type in _get_last_post_time

Reported by: toddlevy's profile toddlevy Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7.5
Component: General Keywords: has-patch needs-testing dev-feedback
Focuses: Cc:


This function starts on line 5610 of

Currently, there is no way to filter the $post_type argument of the _get_last_post_time function.

This creates situations where it's impossible to filter/modify the default post type when _get_last_post_time is called without the $post_type argument.

Suggested enhancement is to add a _get_last_post_time_post_type filter inside the _get_last_post_time function, right after the $field is validated or the timezone gets lowercased.

Something like this...

$post_type = apply_filters( '_get_last_post_time_post_type', $post_type );

Thank you for considering this enhancement.

Attachments (1)

40790.patch (967 bytes) - added by keraweb 5 years ago.
Add filter _get_last_post_time_post_type

Download all attachments as: .zip

Change History (6)

5 years ago

Add filter _get_last_post_time_post_type

#1 @keraweb
5 years ago

  • Keywords has-patch needs-testing dev-feedback added

#2 @toddlevy
5 years ago

Thanks @keraweb! Any chance you can take a gander at this one too...

#3 @keraweb
5 years ago

I see you already have suggested a solution. You can create a patch yourself and add it to your ticket!

#4 @keraweb
5 years ago

Actually, looking at the code.. The patch in this issue would solve #40789 as well since get_lastpostdate() is merely an alias that adds a filter get_lastpostdate for the private function _get_last_post_type().

#5 @keraweb
5 years ago

#40789 was marked as a duplicate.

Note: See TracTickets for help on using tickets.