[wp-trac] [WordPress Trac] #24266: update_post_meta doesn't change post modified date

WordPress Trac noreply at wordpress.org
Sun Dec 13 16:21:22 UTC 2015


#24266: update_post_meta doesn't change post modified date
--------------------------------------+-----------------------------
 Reporter:  DennisSmolek              |       Owner:
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Future Release
Component:  Options, Meta APIs        |     Version:  3.5.1
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-----------------------------
Changes (by swissspidy):

 * keywords:  has-patch needs-unit-tests => has-patch has-unit-tests


Comment:

 I feel like method 3 using the `shutdown` hook is not ideal, because it
 runs after all output is sent. For example, when updating post meta using
 the REST API, you want to return the new modified date, which this
 wouldn't allow for. Also, using global variables isn't ideal and
 `shutdown` is hard to test.

 On the other hand, there can be lots of meta data changes in a single
 request, so using the `shutdown` hook is definitely more performant.

 Long story short, [attachment:24266.4.diff] is an updated patch that adds
 unit tests and also uses only 1 single DB query in
 `update_post_modified_dates()`.

 Pinging @rmccue for feedback.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/24266#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list