Home › Forums › Front-end Issues › Excerpt in a Frontend Form? › Reply To: Excerpt in a Frontend Form?
It doesn’t look like there is a way built into ACF, though it would be a good addition.
It could be done, you’d need to create another fields to use for the excerpt and then create a filter, either acf/pre_save_post or acf/save_post to take the value from the field and put it into the excerpt.
If you use the latter (acf/save_post) be careful of creating a save post infinite loop.
add_action('acf/save_post', 'my_save_post_filter', 20);
function my_save_post_filter($post_id) {
if (get_post_type($post_id) != 'your-post-type')) {
return;
}
// remove this filter to avoid infinite loop
remove_filter('acf/save_post', 'my_save_post_filter', 20);
// get your value and update post
// see https://codex.wordpress.org/Function_Reference/wp_update_post
// put this filter back in place
add_action('acf/save_post', 'my_save_post_filter', 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.