Changeset 8264
- Timestamp:
- 02/18/2019 01:48:34 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php
r8263 r8264 304 304 * Returns the canonical URL for various bbPress pages. 305 305 * 306 * @return stringThe canonical URL.306 * @return array The canonical URL. 307 307 */ 308 308 public function get_canonical_url() { 309 $canonical_url = ''; 309 $canonical_url = false; 310 $supports_paged = true; 310 311 311 312 if ( bbp_is_topic_tag() ) { … … 321 322 } elseif ( bbpress()->displayed_user && bbpress()->displayed_user->exists() ) { 322 323 // This covers all user pages rather than using 6 different bbp_is_*() calls. 323 $canonical_url = 'https://profiles.wordpress.org/' . bbpress()->displayed_user->user_nicename . '/'; 324 } 325 326 return $canonical_url; 324 $canonical_url = 'https://profiles.wordpress.org/' . bbpress()->displayed_user->user_nicename . '/'; 325 $supports_paged = false; 326 } 327 328 return [ $canonical_url, $supports_paged ]; 327 329 } 328 330 … … 331 333 */ 332 334 public function rel_canonical() { 333 $canonical_url= $this->get_canonical_url();335 list( $canonical_url, $canonical_supports_paged ) = $this->get_canonical_url(); 334 336 335 337 if ( bbp_is_single_topic() || bbp_is_single_forum() ) { … … 339 341 // Make sure canonical has pagination if needed. 340 342 $page = get_query_var( 'paged', 0 ); 341 if ( $canonical_url && $ page >= 2 ) {343 if ( $canonical_url && $canonical_supports_paged && $page >= 2 ) { 342 344 $canonical_url .= 'page/' . absint( $page ) . '/'; 343 345 } … … 354 356 global $wp_query; 355 357 356 $canonical_url = $this->get_canonical_url(); 357 $max_pages = $wp_query->max_num_pages; 358 list( $canonical_url ) = $this->get_canonical_url(); 359 360 $max_pages = $wp_query->max_num_pages; 358 361 359 362 if ( bbp_is_single_view() ) {
Note: See TracChangeset
for help on using the changeset viewer.