bbp_get_topic_edit_url( int $topic_id )

Return URL to the topic edit page

Description

Parameters

$topic_id

(Optional) Topic id

Return

(string) Topic edit url

Source

File: bp-forums/topics/template.php

2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
function bbp_get_topic_edit_url( $topic_id = 0 ) {
    global $wp_rewrite;
 
    $bbp = bbpress();
 
    $topic = bbp_get_topic( bbp_get_topic_id( $topic_id ) );
    if ( empty( $topic ) )
        return;
 
    // Remove view=all link from edit
    $topic_link = bbp_remove_view_all( bbp_get_topic_permalink( $topic_id ) );
 
    // Pretty permalinks
    if ( $wp_rewrite->using_permalinks() ) {
        $url = trailingslashit( $topic_link ) . $bbp->edit_id;
        $url = trailingslashit( $url );
 
    // Unpretty permalinks
    } else {
        $url = add_query_arg( array( bbp_get_topic_post_type() => $topic->post_name, $bbp->edit_id => '1' ), $topic_link );
    }
 
    // Maybe add view=all
    $url = bbp_add_view_all( $url );
 
    return apply_filters( 'bbp_get_topic_edit_url', $url, $topic_id );
}

Changelog

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