Support

Account

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);