pmpro_get_slug

The Paid Memberships Pro pmpro get slug function.

Description

pmpro_get_slug( $post_id ); 

Parameters (1)

0. $post_id
The post id.

Usage

  1. if ( !function_exists( 'pmpro_get_slug' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/functions.php'; 
  3.  
  4. // The post id. 
  5. $post_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = pmpro_get_slug($post_id); 
  9.  

Defined (1)

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

/includes/functions.php  
  1. function pmpro_get_slug($post_id) 
  2. global $pmpro_slugs, $wpdb; 
  3.  
  4. //make sure post id is int for security 
  5. $post_id = intval($post_id); 
  6.  
  7. if(!$pmpro_slugs[$post_id]) 
  8. $pmpro_slugs[$post_id] = $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE ID = '" . $post_id . "' LIMIT 1"); 
  9.  
  10. return $pmpro_slugs[$post_id];