bbp_get_topic_permalink( int $topic_id,  $redirect_to = '' )

Return the link to the topic

Description

Parameters

$topic_id

(int) (Optional) Topic id

$string

(Optional) $redirect_to Optional. Pass a redirect value for use with shortcodes and other fun things.

Return

(string) Permanent link to topic

Source

File: bp-forums/topics/template.php

	function bbp_get_topic_permalink( $topic_id = 0, $redirect_to = '' ) {
		$topic_id = bbp_get_topic_id( $topic_id );

		// Use the redirect address
		if ( !empty( $redirect_to ) ) {
			$topic_permalink = esc_url_raw( $redirect_to );

		// Use the topic permalink
		} else {
			$topic_permalink = get_permalink( $topic_id );
		}

		return apply_filters( 'bbp_get_topic_permalink', $topic_permalink, $topic_id );
	}

Changelog

Changelog
Version Description
bbPress (r2485) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.