post_permalink

Retrieve permalink from post ID.

Description

(string|false) post_permalink( (int) $post_id = 0 ); 

Returns (string|false)

Parameters (1)

0. $post_id — Optional. (int)
Post ID or WP_Post object. Default is global $post.

Usage

  1. if ( !function_exists( 'post_permalink' ) ) { 
  2. require_once ABSPATH . WPINC . '/deprecated.php'; 
  3.  
  4. // Optional. Post ID or WP_Post object. Default is global $post. 
  5. $post_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = post_permalink($post_id); 
  9.  

Defined (1)

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

/wp-includes/deprecated.php  
  1. function post_permalink( $post_id = 0 ) { 
  2. _deprecated_function( __FUNCTION__, '4.4.0', 'get_permalink()' ); 
  3.  
  4. return get_permalink( $post_id );