-
-
Save dgoze/dfa80e76653b6a292fd1c68004056c8a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Set excerpt from ACF field | |
*/ | |
add_action('acf/save_post', function($post_id) { | |
$post_excerpt = get_field( 'short_description', $post_id ); | |
if ( ( !empty( $post_id ) ) AND ( $post_excerpt ) ) { | |
// Update post options array | |
$update_post_excerpt_args = array( | |
'ID' => $post_id, | |
'post_excerpt' => $post_excerpt, | |
); | |
wp_update_post( $update_post_excerpt_args ); | |
} | |
}, 50); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment