jetpack_stats_api_path

Abstract out building the rest api stats path.

Description

(string) jetpack_stats_api_path( (string) $resource = '' ); 

Returns (string)

Parameters (1)

0. $resource — Optional. (string) => ''
The resource.

Usage

  1. if ( !function_exists( 'jetpack_stats_api_path' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/stats.php'; 
  3.  
  4. // The resource. 
  5. $resource = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = jetpack_stats_api_path($resource); 
  9.  

Defined (1)

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

/modules/stats.php  
  1. function jetpack_stats_api_path( $resource = '' ) { 
  2. $resource = ltrim( $resource, '/' ); 
  3. return sprintf( '/sites/%d/stats/%s', stats_get_option( 'blog_id' ), $resource );