bbp_get_topic_reply_link( array $args = array() )

Return the link to go directly to the reply form


Description Description


Parameters Parameters

$args

(Optional) Arguments

Default value: array()


Top ↑

Return Return

(string) Link for a reply to a topic


Top ↑

Source Source

File: 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_x( 'Reply', 'verb', 'bbpress' ),
		), 'get_topic_reply_link' );

		// Get the topic to use it's ID and post_parent
		$topic = bbp_get_topic( $r['id'] );

		// Bail if no topic or user cannot reply
		if ( empty( $topic ) || bbp_is_single_reply() || ! bbp_current_user_can_access_create_reply_form() ) {
			return;
		}

		// Add $uri to the array, to be passed through the filter
		$r['uri'] = '#new-post';
		$retval   = $r['link_before'] . '<a role="button" href="' . esc_url( $r['uri'] ) . '" class="bbp-topic-reply-link">' . $r['reply_text'] . '</a>' . $r['link_after'];

		// Filter & return
		return apply_filters( 'bbp_get_topic_reply_link', $retval, $r, $args );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.