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
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
| 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.