Tell us what you are trying to do?
I'm looking to combine multiple non-types custom fields into one field. I'd like to follow this example:
add_filter('save_post', 'combine_my_fields');
function combine_my_fields($post_id, $post) {
$address = get_post_meta($post_id, 'wpcf-street', true);
$address = ', ' . get_post_meta($post_id, 'wpcf-city', true);
$address = ', ' . get_post_meta($post_id, 'wpcf-zip', true);
update_post_meta($post_id, 'full-address', $address);
}
however the field I'm working with were not created by Types, but another plugin.
[wpv-post-field name='_VenueAddress']
[wpv-post-field name='_VenueCity']
[wpv-post-field name='_VenueZip']
Could I get an example the proper syntax for one of the lines please? Thanks
Is there any documentation that you are following?
https://toolset.com/forums/topic/combine-custom-fields-into-single-variable/
Is there a similar example that we can see?
What is the link to your site?
Well, when you get or update Types fields, you need to ensure that you call a Post Meta Slug with wpcf-prefix.
This means you should use slugs like "wpcf-my-field-slug".
For non-Types fields, this is not necessary.
This is Custom code, that is fully built on WordPress Codex, which I suggest you consult:
https://codex.wordpress.org/Function_Reference/update_post_meta
https://developer.wordpress.org/reference/functions/get_post_meta/
Thanks!