bbp_get_topic_reply_link
Return the link to go directly to the reply form.
Description
(string) bbp_get_topic_reply_link( (array) $args = array() );
Returns (string)
Link for a reply to a topic
Parameters (1)
- 0. $args — Optional. (array) =>
array()
- The args.
Usage
if ( !function_exists( 'bbp_get_topic_reply_link' ) ) { require_once ABSPATH . PLUGINDIR . 'bbpress/includes/topics/template.php'; } // The args. $args = array(); // NOTICE! Understand what this does before running. $result = bbp_get_topic_reply_link($args);
Defined (1)
The function is defined in the following location(s).
- /includes/topics/template.php
- function bbp_get_topic_reply_link( $args = array() ) {
- // Parse arguments against default values
- $r = bbp_parse_args( $args, array(
- 'id' => 0,
- 'link_before' => '',
- 'link_after' => '',
- 'reply_text' => esc_html__( 'Reply', bbpress ),
- ), 'get_topic_reply_link' );
- // Get the reply to use it's ID and post_parent
- $topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );
- // Bail if no reply or user cannot reply
- if ( empty( $topic ) || ! bbp_current_user_can_access_create_reply_form() )
- return;
- $uri = '#new-post';
- // Add $uri to the array, to be passed through the filter
- $r['uri'] = $uri;
- $retval = $r['link_before'] . '<a href="' . esc_url( $r['uri'] ) . '" class="bbp-topic-reply-link">' . $r['reply_text'] . '</a>' . $r['link_after'];
- return apply_filters( 'bbp_get_topic_reply_link', $retval, $r, $args );
- }