gestion accueil

This commit is contained in:
sebvtl728
2025-02-02 10:22:18 +01:00
parent 57f618a0e4
commit f70d21ae71
6 changed files with 240 additions and 5 deletions
@@ -269,4 +269,21 @@ function custom_cors_headers() {
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
header("Access-Control-Allow-Headers: Content-Type, Authorization");
}
add_action('init', 'custom_cors_headers');
add_action('init', 'custom_cors_headers');
// 🔹 Autoriser la modification des champs ACF via l'API REST
add_action('rest_api_init', function () {
register_rest_field(
'page', // Type de post
'acf', // Champ ACF
[
'get_callback' => function ($object) {
return get_fields($object['id']);
},
'update_callback' => function ($value, $object) {
return update_fields($object->ID, $value);
},
'schema' => null,
]
);
});