I am trying to: use custom fields created with Toolset as snippet variables in Yoast (WP SEO). This is possible with WP custom fields as described in the following link: hidden link
Is this possible with Toolset custom fields?
I don't think debug info is relevant in this case, but I've included it just in case.
Thank you for contacting us and I'll be happy to assist.
As explained in the link that you've shared ( hidden link ), simple custom fields like a single line type can be used directly in snippet variables, in this format:
%%cf_<custom-field-name>%%
For example, if you have a Toolset custom field with the slug "book-info", it can be used like this:
%%cf_wpcf-book-info%%
Note: By default, Toolset custom fields are saved with a "wpcf-" prefix appended to their slugs.
For other complex type custom fields like radio buttons, checkboxes, etc, you can register a custom template variable ( refer to the section "Registering a custom template variable" from that same link that you shared ).
I hope this helps and for personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors: https://toolset.com/contractors/
The field with the same slug works as expected on my test website:
Screenshot - Custom field setting: hidden link
Screenshot - Custom field value: hidden link
Screenshot - Custom field in the snippet preview: hidden link
I'll recommend testing this with all extra plugins (other than Toolset and Yoast SEO) disabled and with a default theme like Twenty Nineteen. This will help in narrowing down to a possible conflict.
I apologize if my mentioning of custom code resulted in confusion.
Let me clarify this further. My earlier message can be divided into two parts, as shown in this screenshot: hidden link
For part 1, where you just need to use a Toolset custom field's value, which is a simple "single line" type field, no custom code changes will be needed and the format %%cf_<custom-field-name>%% works inside the Yoast SEO's snippet preview section.
The screenshots from my last message confirm this as I didn't include any custom code for this testing.
The custom code will be needed for part 2, where you need to use a value from Toolset custom field which stores data in a complex way, for example, the radio buttons, checkbox or checkboxes type fields. If you only need values from "single line" type custom fields, you won't need any custom code.
I hope this clarifies and please let me know if you need any further assistance around this.
OK. This seems to be working (sort of). It does not populate the snippet immediately. I have to save the post and then re-open it to see the change. Is this how it worked in your test?
On my test website, the snippet preview updates with the value of the custom field immediately/on the fly, without having to save or update the post.
( screencast: hidden link )