Support

Account

Home Forums Feature Requests Field to write into the_content & the_excerpt

Solved

Field to write into the_content & the_excerpt

  • Hi,
    i’m wondering if you can integrate a native field who can write into the_content and the excerpt ?

  • Hi @sireneweb

    Yes. This is quite easy and all you need to do is add a WYSIWYG field, then in your functions.php file, use the acf/update_value filter to hook into the save.

    In the filter, you can get the value and use it to update the post’s the_content value. Have a look at the wp_update_post function on the WP codex site.

    Good luck!

  • Thanks for your feedback 🙂

  • This should work for you. Make the field name ‘the_content’. I am wrapping this up into a plugin and will also include the_excerpt, and featured_image.

    function hg_acf_save_content( $value, $post_id, $field )
    {
    	wp_update_post( array( 'ID' => $post_id, 'post_content' =>  $value ) );
    	return $value;
    }
    add_filter('acf/update_value/name=the_content', 'hg_acf_save_content', 10, 3);
Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Field to write into the_content & the_excerpt’ is closed to new replies.