Skip to content

Instantly share code, notes, and snippets.

@haleeben
Last active September 28, 2017 06:21
Show Gist options
  • Save haleeben/959d1e57a91b0795d13e3942e86c3a24 to your computer and use it in GitHub Desktop.
Save haleeben/959d1e57a91b0795d13e3942e86c3a24 to your computer and use it in GitHub Desktop.
add_action( 'transition_post_status', 'update_expired_post_meta', 10, 3 );
function update_expired_post_meta( $new_publish_status, $old_publish_status, $post ){
if( 'expired' == $new_publish_status ){
// Change the ACF field value to false
update_field( 'field_name', false, $post->ID );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment