bbp_get_topic_last_reply_url

Return the link to the last reply in a topic.

Description

(string) bbp_get_topic_last_reply_url( (int) $topic_id = 0 ); 

Returns (string)

Topic last reply url

Parameters (1)

0. $topic_id — Optional. (int)
Topic id

Usage

  1. if ( !function_exists( 'bbp_get_topic_last_reply_url' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/topics/template.php'; 
  3.  
  4. // Optional. Topic id 
  5. $topic_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_get_topic_last_reply_url($topic_id); 
  9.  

Defined (1)

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

/includes/topics/template.php  
  1. function bbp_get_topic_last_reply_url( $topic_id = 0 ) { 
  2. $topic_id = bbp_get_topic_id( $topic_id ); 
  3. $reply_id = bbp_get_topic_last_reply_id( $topic_id ); 
  4.  
  5. if ( !empty( $reply_id ) && ( $reply_id !== $topic_id ) ) { 
  6. $reply_url = bbp_get_reply_url( $reply_id ); 
  7. } else { 
  8. $reply_url = bbp_get_topic_permalink( $topic_id ); 
  9.  
  10. return apply_filters( 'bbp_get_topic_last_reply_url', $reply_url );