Home › Forums › ACF PRO › Frontend Post Excerpt Field With acf_form() › Reply To: Frontend Post Excerpt Field With acf_form()
Well, I guess I figured it out. However, would doing this even be advisable?
I ask because… if we’re be able to manage the post_excerpt
via acf/save_post
with a custom ACF WYSIWG field, wouldn’t it just bloat the database? I.e. have a value stored for both the ACF and post_excerpt
field?
The code I’ve used:
function update_post_excerpt($post_id) {
// Set excerpt value from field
$post_excerpt = get_field('field_12345',$post_id);
// Update post options array
$update_post_excerpt_args = array(
'ID' => $post_id,
'post_excerpt' => $post_excerpt,
);
// Update the post into the database
wp_update_post( $update_post_excerpt_args );
}
add_action('acf/save_post', 'update_post_excerpt', 20);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.