bbp_get_forum_topics_feed_link( int $forum_id )

Retrieve the link for the forum feed

Description

Parameters

$forum_id

(Optional) Forum ID.

Return

(string)

Source

File: bp-forums/forums/template.php

2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
function bbp_get_forum_topics_feed_link( $forum_id = 0 ) {
 
    // Validate forum id
    $forum_id = bbp_get_forum_id( $forum_id );
 
    // Forum is valid
    if ( !empty( $forum_id ) ) {
 
        // Define local variable(s)
        $link = '';
 
        // Pretty permalinks
        if ( get_option( 'permalink_structure' ) ) {
 
            // Forum link
            $url = trailingslashit( bbp_get_forum_permalink( $forum_id ) ) . 'feed';
            $url = user_trailingslashit( $url, 'single_feed' );
 
        // Unpretty permalinks
        } else {
            $url = home_url( add_query_arg( array(
                'feed'                    => 'rss2',
                bbp_get_forum_post_type() => get_post_field( 'post_name', $forum_id )
            ) ) );
        }
 
        $link = '<a href="' . esc_url( $url ) . '" class="bbp-forum-rss-link topics"><span>' . esc_attr__( 'Discussions', 'buddyboss' ) . '</span></a>';
    }
 
    return apply_filters( 'bbp_get_forum_topics_feed_link', $link, $url, $forum_id );
}

Changelog

Changelog
Version Description
bbPress (r3172) 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.