bbp_get_topic_permalink( int $topic_id, string $redirect_to = '' )
Return the link to the topic
Description Description
Parameters Parameters
- $topic_id
-
(Optional) Topic id
- $redirect_to
-
(Optional) Pass a redirect value for use with shortcodes and other fun things.
Default value: ''
Return Return
(string) Permanent link to topic
Source Source
File: includes/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 );
}
// Filter & return
return apply_filters( 'bbp_get_topic_permalink', $topic_permalink, $topic_id );
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |