gestion accueil
This commit is contained in:
@@ -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,
|
||||
]
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user