ms_api

Procedural way to load the API instance.

Description

(MS_Controller_Api) ms_api(); 

Call this function inside the init hook or later. Using it earlier might cause problems because other parts of M2 might not be completely initialized.

Returns (MS_Controller_Api)


Usage

  1. if ( !function_exists( 'ms_api' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'membership-2/app/controller/class-ms-controller-api.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ms_api(); 
  7.  

Defined (1)

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

/app/controller/class-ms-controller-api.php  
  1. function ms_api() { 
  2. if ( ! did_action( 'init' ) ) { 
  3. _doing_it_wrong( 
  4. 'ms_api',  
  5. 'ms_api() is called before the "init" hook, this is too early!',  
  6. '1.0.1.2' 
  7. ); 
  8.  
  9. return MS_Controller_Api::instance();