Home Forums Feature Requests Field to write into the_content & the_excerpt


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 ?

    • Elliot

    • July 11, 2013 at 5:10 pm

    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)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.