// Autoriser la modification des meta Yoast via l'API REST add_action('rest_api_init', function () { register_rest_field('formation', '_yoast_wpseo_focuskw', array( 'get_callback' => function($object) { return get_post_meta($object['id'], '_yoast_wpseo_focuskw', true); }, 'update_callback' => function($value, $object) { update_post_meta($object->ID, '_yoast_wpseo_focuskw', $value); }, 'schema' => array('type' => 'string') )); register_rest_field('formation', '_yoast_wpseo_title', array( 'get_callback' => function($object) { return get_post_meta($object['id'], '_yoast_wpseo_title', true); }, 'update_callback' => function($value, $object) { update_post_meta($object->ID, '_yoast_wpseo_title', $value); }, 'schema' => array('type' => 'string') )); register_rest_field('formation', '_yoast_wpseo_metadesc', array( 'get_callback' => function($object) { return get_post_meta($object['id'], '_yoast_wpseo_metadesc', true); }, 'update_callback' => function($value, $object) { update_post_meta($object->ID, '_yoast_wpseo_metadesc', $value); }, 'schema' => array('type' => 'string') )); });