bbp_get_forum_last_reply_url( int $forum_id )
Return the url to the last reply in a forum
Description
Parameters
- $forum_id
-
(Optional) Forum id
Return
(string) Paginated URL to latest reply
Source
File: bp-forums/forums/template.php
function bbp_get_forum_last_reply_url( $forum_id = 0 ) {
$forum_id = bbp_get_forum_id( $forum_id );
// If forum has replies, get the last reply and use its url
$reply_id = bbp_get_forum_last_reply_id( $forum_id );
if ( !empty( $reply_id ) ) {
$reply_url = bbp_get_reply_url( $reply_id );
// No replies, so look for topics and use last permalink
} else {
$reply_url = bbp_get_forum_last_topic_permalink( $forum_id );
// No topics either, so set $reply_url as empty string
if ( empty( $reply_url ) ) {
$reply_url = '';
}
}
// Filter and return
return apply_filters( 'bbp_get_forum_last_reply_url', $reply_url, $forum_id );
}
Changelog
| Version | Description |
|---|---|
| bbPress (r2683) | 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.