Skip Navigation

[Closed] Update custom fields using wordpress api

This support ticket is created 2 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 2 years, 2 months ago.

Author
Posts
#2544159

Tell us what you are trying to do?
My ultimate goal is to create posts for a custom post type from the front-end using WordPress API. For now, I am creating the records but I cannot post data to the Toolset's custom fields. I checked the documentation of toolset and the most recent response is the following:
https://toolset.com/forums/topic/update-toolset-meta-data-via-the-rest-api/. --------> which says that "There is no support for writing to Toolset custom fields. But. Toolset custom fields are stored as standard post meta, and so you can use the normal WordPress REST API to store custom fields." --> for me, this didn't work.

Is there any documentation that you are following?
No
Is there a similar example that we can see?
No
What is the link to your site?
hidden link

#2544267

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

That advice in the thread you linked to is still accurate. You can use the WordPress REST API to add post meta to any post.

Toolset stores custom fields in exactly the same way, in wp_postmeta, as meta_key:meta_value pairs.

The one thing you need to be careful with is that Toolset adds a wpcf- prefix to the meta_key when saving field values.

So if your Toolset custom field slug is 'priority', then Toolset stores the data with a meta_key of 'wpcf-priority'.

If you want to populate the database with such post content via the REST API then you must also use wpcf-priority as the meta_key, otherwise Toolset will not recognise it as a Toolset custom field.

If you have tried to create posts and add custom fields via the REST API I suggest you inspect the database directly, specifically look at the rows in wp_postmeta for the post you added. Do you see entries for the post meta you tried to publish? (Whether they are Toolset fields or not.)

The topic ‘[Closed] Update custom fields using wordpress api’ is closed to new replies.