bbp_get_cancel_reply_to_link

Return the cancellation link for a reply to a reply.

Description

(string) bbp_get_cancel_reply_to_link( (string) $text = '' ); 

Returns (string)

The cancellation link

Parameters (1)

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

Usage

  1. if ( !function_exists( 'bbp_get_cancel_reply_to_link' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/replies/template.php'; 
  3.  
  4. // The cancel text 
  5. $text = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_get_cancel_reply_to_link($text); 
  9.  

Defined (1)

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

/includes/replies/template.php  
  1. function bbp_get_cancel_reply_to_link( $text = '' ) { 
  2.  
  3. // Bail if not hierarchical or editing a reply 
  4. return; 
  5.  
  6. // Set default text 
  7. if ( empty( $text ) ) { 
  8. $text = __( 'Cancel', bbpress ); 
  9.  
  10. $reply_to = isset( $_GET['bbp_reply_to'] ) ? (int) $_GET['bbp_reply_to'] : 0; 
  11.  
  12. // Set visibility 
  13. $style = !empty( $reply_to ) ? '' : ' style="display:none;"'; 
  14. $link = remove_query_arg( array( 'bbp_reply_to', '_wpnonce' ) ) . '#post-' . $reply_to; 
  15. $retval = '<a rel="nofollow" id="bbp-cancel-reply-to-link" href="' . esc_url( $link ) . '"' . $style . '>' . esc_html( $text ) . '</a>'; 
  16.  
  17. return apply_filters( 'bbp_get_cancel_reply_to_link', $retval, $link, $text );