Updating First Name and Last Name Field Entries via API

[ad_1]

Hi!

I’m working with your awesome API for the plugin. Really useful! I’m trying to update a Name field.

Can you provide an example of how to construct correct entry meta data for the Name field that I could use for the update_form_entry() API method?

For simple text fields, this would work just fine:

$entry_meta = array(
				
				array(
					'name' => 'text-1',
					'value' => 'new value'
				)
);

Name fields, however, are more complex. I have to update something like this:

[meta_data] => Array
        (
            [name-1] => Array
                (
                    [id] => 436
                    [value] => Array
                        (
                            [first-name] => Anthony
                            [last-name] => Brooks
                        )

                )
...

I tried different tricks but sadly without success. First and last name went blank. To give you an example, this code snippet does not work:

array(
					'name' => 'name-1',
					'value' => array(
						'first-name' => 'new first name',
						'last-name' => 'new last name'
					)
				)

I also tried things like json_encode() and different names for keys (for example name-1-first-name). I’m running out of ideas. Could you help me out please?

Thanks a lot!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer