Changeset 9186
- Timestamp:
- 10/15/2019 10:08:12 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-breathe/functions.php
r9062 r9186 46 46 } 47 47 add_action( 'wp_head', __NAMESPACE__ . '\no_robots_search_results', 9 ); 48 49 50 /** 51 * Outputs `<link rel="canonical">` tags where needed. 52 */ 53 function rel_canonical() { 54 $canonical = false; 55 56 if ( is_front_page() ) { 57 $canonical = home_url( '/' ); 58 } 59 60 if ( $canonical && get_query_var( 'paged' ) > 1 ) { 61 $canonical .= 'page/' . (int) get_query_var( 'paged' ) . '/'; 62 } 63 64 if ( $canonical ) { 65 printf( '<link rel="canonical" href="%s">' . "\n", esc_url( $canonical ) ); 66 } 67 } 68 add_action( 'wp_head', __NAMESPACE__ . '\rel_canonical' ); 48 69 49 70 /**
Note: See TracChangeset
for help on using the changeset viewer.