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

WordPress Trac noreply at wordpress.org
Tue Oct 28 23:36:36 UTC 2014


#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           |     Focuses:
--------------------------------+-----------------------------
Changes (by nofearinc):

 * keywords:  needs-patch => has-patch


Comment:

 A possible solution is a helper function `update_post_modified_date` that
 would update the modified date on add, update and delete.  Sample use:

 {{{
 add_action( 'updated_postmeta', 'test_update_post_date', 10, 4 );
 add_action( 'deleted_post_meta', 'test_update_post_date', 10, 4 );
 add_action( 'added_post_meta', 'test_update_post_date', 10, 4 );

 function test_update_post_date( $meta_id, $post_id, $meta_key, $meta_value
 ) {
         update_post_modified_date( $post_id );
 }
 }}}

 I'm not a great fan of the the lack of a common action for updating (also,
 `deleted_post_meta` includes $meta_ids instead of $meta_id), but it could
 work.

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


More information about the wp-trac mailing list