Support

Account

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);
    }