wpcf7_rest_api_init

The Contact Form 7 wpcf7 rest api init function.

Description

wpcf7_rest_api_init(); 

Usage

  1. if ( !function_exists( 'wpcf7_rest_api_init' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/includes/rest-api.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wpcf7_rest_api_init(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/rest-api.php  
  1. function wpcf7_rest_api_init() { 
  2. $namespace = 'contact-form-7/v1'; 
  3.  
  4. register_rest_route( $namespace,  
  5. '/contact-forms',  
  6. array( 
  7. array( 
  8. 'methods' => WP_REST_Server::READABLE,  
  9. 'callback' => 'wpcf7_rest_get_contact_forms',  
  10. ),  
  11. array( 
  12. 'methods' => WP_REST_Server::CREATABLE,  
  13. 'callback' => 'wpcf7_rest_create_contact_form',  
  14. ),  
  15. ); 
  16.  
  17. register_rest_route( $namespace,  
  18. '/contact-forms/(?P<id>\d+)',  
  19. array( 
  20. array( 
  21. 'methods' => WP_REST_Server::READABLE,  
  22. 'callback' => 'wpcf7_rest_get_contact_form',  
  23. ),  
  24. array( 
  25. 'methods' => WP_REST_Server::EDITABLE,  
  26. 'callback' => 'wpcf7_rest_update_contact_form',  
  27. ),  
  28. array( 
  29. 'methods' => WP_REST_Server::DELETABLE,  
  30. 'callback' => 'wpcf7_rest_delete_contact_form',  
  31. ),  
  32. );