Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Christopher

Last modified date of custom post is not being updated

The last modified date of a custom post is not being updated when one of its ACF fields is updated via Admin Columns on the post listing page. Please investigate. Very important for the functioning of my app.

Thanks!

Chris.

10 years ago
Tobias Schutter
Developer

Hi Chris,

The modified_date is not being updated because we’re using the ACF API, which does not trigger ‘wp_update_post’.

But there is an easy solution. You can use our hook cac/inline-edit/after_ajax_column_save to update it.

Just add this code to your theme’s functions.php and the last modified date will be updated when using inline-edit.


/**
 * Example: Update last post modified date when using inline-edit
 *
 */
function my_cac_update_last_modifed_date_on_save( $column, $id, $value, $editable_model_object ) {

	// only apply to post object
	if ( 'post' == $column->storage_model->meta_type ) {

		// updating post with no vars to set modified date
		wp_update_post( array( 'ID' => $id ) );
	}
}
add_action( 'cac/inline-edit/after_ajax_column_save', 'my_cac_update_last_modifed_date_on_save', 10, 4 );

Here is more information about the action cac/inline-edit/after_ajax_column_save.

Tobias

10 years ago

You must be logged in to reply to this topic.