[wp-trac] [WordPress Trac] #40790: Ability to filter $post_type in _get_last_post_time

WordPress Trac noreply at wordpress.org
Wed May 17 15:30:11 UTC 2017


#40790: Ability to filter $post_type in _get_last_post_time
-------------------------+-----------------------------
 Reporter:  toddlevy     |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:  4.7.5
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 This function starts on line 5610 of
 https://github.com/WordPress/WordPress/blob/4.7.5/wp-includes/post.php

 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...

  {{{#!php
 $post_type = apply_filters( '_get_last_post_time_post_type', $post_type );
 }}}

 Thank you for considering this enhancement.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40790>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list