Changeset 7369
- Timestamp:
- 11/17/2025 08:46:26 PM (6 weeks ago)
- File:
-
- 1 edited
-
trunk/src/includes/forums/template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/forums/template.php
r7360 r7369 342 342 $forum_id = bbp_get_forum_id( $forum_id ); 343 343 344 // Default return value 345 $forum_permalink = ''; 346 344 347 // Use the redirect address 345 348 if ( ! empty( $redirect_to ) ) { 346 349 $forum_permalink = esc_url_raw( $redirect_to ); 347 350 348 // Use the topic permalink 349 } else { 351 // Plain permalinks: maybe build a slug-based URL using the forum query_var 352 } elseif ( ! get_option( 'permalink_structure' ) ) { 353 354 // Get the forum object 355 $forum = bbp_get_forum( $forum_id ); 356 357 // Forum exists 358 if ( ! empty( $forum ) ) { 359 360 // Get the post type object from the forum 361 $post_type = get_post_type_object( $forum->post_type ); 362 363 // Publicly queryable by var 364 if ( ! empty( $post_type->query_var ) ) { 365 366 // Use hierarchical path (parent/child/...) when applicable 367 $path = ! empty( $post_type->hierarchical ) 368 ? get_page_uri( $forum_id ) 369 : $forum->post_name; 370 371 // Add path to query var 372 $forum_permalink = add_query_arg( 373 $post_type->query_var, 374 $path, 375 home_url( '/' ) 376 ); 377 } 378 } 379 } 380 381 // Fallback to forum permalink 382 if ( empty( $forum_permalink ) ) { 350 383 $forum_permalink = get_permalink( $forum_id ); 351 384 }
Note: See TracChangeset
for help on using the changeset viewer.