bbp_get_topic_edit_url( int $topic_id )
Return URL to the topic edit page
Description Description
Parameters Parameters
- $topic_id
-
(Optional) Topic id
Return Return
(string) Topic edit url
Source Source
File: includes/topics/template.php
function bbp_get_topic_edit_url( $topic_id = 0 ) {
$topic = bbp_get_topic( $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, previously used `bbp_use_pretty_urls()`
// https://bbpress.trac.wordpress.org/ticket/3054
if ( false === strpos( $topic_link, '?' ) ) {
$url = trailingslashit( $topic_link ) . bbp_get_edit_slug();
$url = user_trailingslashit( $url );
// Unpretty permalinks
} else {
$url = add_query_arg( array(
bbp_get_topic_post_type() => $topic->post_name,
bbp_get_edit_rewrite_id() => '1'
), $topic_link );
}
// Maybe add view=all
$url = bbp_add_view_all( $url );
// Filter & return
return apply_filters( 'bbp_get_topic_edit_url', $url, $topic_id );
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |