Home Forums Backend Issues (wp-admin) Add ACF Field to Featured Image Meta Box


Add ACF Field to Featured Image Meta Box

  • I’m trying to append a Featured Video field group to the existing Featured Image meta box. I created the field group and set the Active status to false so that it won’t render. I then added the following function to render the acf_form in the Featured Image meta box:

    add_filter ( 'admin_post_thumbnail_html', function ( $content, $post_id ) {
    	acf_form ( array (
    		'post_id' => $post_id,
    		'field_groups' => array (
    		'form' => false,
    		'field_el' => false,
    	) );
    	$content .= ob_get_contents();
    	return $content;
    }, 10, 2 );

    This does render the field group to the meta box, and it also passes the data along with the form submission… but it doesn’t save the meta value to the post. I’m assuming that I need to tell WordPress to look for that form field and update the meta accordingly, I’m just not sure exactly where to do that.

    Any ideas?

  • There are too many things that could be causing the values not to be saved correctly.

    1) acf_form() event when used in the admin, requires that acf_form_head() is called.
    2) values submitted using acf_form() are usually processed differently then how acf normally does this for admin submission.
    3) unknowns

    Why not use acf to hide the “feature image” meta box and create your own using an ACF field group?

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Add ACF Field to Featured Image Meta Box’ is closed to new replies.