Support

Account

Home Forums Gutenberg Update ACF meta via native Gutenberg block?

Unread

Update ACF meta via native Gutenberg block?

  • Hi. I have a “legacy” ACF field, and I would like to use a native Gutenberg Meta-Block to update the field, as per explanations in the block editor handbook. This is the relevant part

    const [ meta, setMeta ] = useEntityProp( 'postType', 'postType', 'meta' );
     
    	 const metaFieldValue = meta._legacyField;
    	 const updateMetaValue = ( newValue ) => {
    		 setMeta( { ...meta, _legacyField: newValue } );
    	 };
     

    Once I redefine the legacy field in the Meta-Block-Plugin using register_post_meta(), the Block will be able to *read* the field value. However, when attempting to update the field value, I get a 403 response from the REST API.

    Updating the field value via the standard ACF metabox below works just fine, as does updating a new meta-key defined within the plugin. The problem appears only when the meta to be updated key has been defined in ACF.

    Is there any way to update ACF-defined metafields via a native Gutenberg metablock / rest-api? Some people suggest that ACF meta data needs a specific format for the update – could that be the problem?

    cf https://stackoverflow.com/questions/53596688/update-acf-fields-inside-layout-via-wp-api

    Thanks!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.