Home › Forums › ACF PRO › Edit Yoast Fields – Front End Form › Reply To: Edit Yoast Fields – Front End Form
Thanks for the help there. I did get the title and meta to update with a static value in the code at the bottom of the post.
Just having a little trouble getting the fields value from the front end form before update.
I tried a few variations of this.
function my_acf_update_value_meta( $value, $post_id, $field )
{
$field_key = “field_57205386becf2”;
$field = get_field_object($field_key);
$yoast_value = $field[‘value’];
$value = update_post_meta( get_the_ID(), ‘_yoast_wpseo_metadesc’, $yoast_value );
return $value;
}
add_filter(‘acf/update_value/key=field_57205386becf2’, ‘my_acf_update_value_meta’, 10, 3);
Working with static values:
function my_acf_update_value_meta( $value, $post_id, $field )
{
$value = update_post_meta( get_the_ID(), ‘_yoast_wpseo_metadesc’, ‘My Meta Description’ );
return $value;
}
add_filter(‘acf/update_value/key=field_57205386becf2’, ‘my_acf_update_value_meta’, 10, 3);
function my_acf_update_value_title( $value, $post_id, $field )
{
$value = update_post_meta( get_the_ID(), ‘_yoast_wpseo_title’, ‘My Meta Title’ );
return $value;
}
add_filter(‘acf/update_value/key=field_571fd28705139’, ‘my_acf_update_value_title’, 10, 3);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.