Changeset 9190
- Timestamp:
- 10/16/2019 07:17:46 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r9180 r9190 165 165 */ 166 166 public static function archive_link_rel_prev_next() { 167 global $paged, $wp_query ;167 global $paged, $wp_query, $wp_rewrite; 168 168 if ( ! is_archive() && ! is_search() ) { 169 169 return; … … 178 178 $prevpage = intval( $paged ) - 1; 179 179 180 // re-implement get_pagenum_link() using our canonical url. 181 $current_url = Template::get_current_url(); 182 if ( ! $current_url ) { 183 return; 184 } 185 186 $current_url = remove_query_arg( 'paged', $current_url ); 187 $current_url = preg_replace( "|{$wp_rewrite->pagination_base}/\d+/?$|", '', $current_url ); 188 189 // Just assume pretty permalinks everywhere. 190 $next_url = $current_url . "{$wp_rewrite->pagination_base}/{$nextpage}/"; 191 $prev_url = $current_url . ( $prevpage > 1 ? "{$wp_rewrite->pagination_base}/{$prevpage}/" : '' ); 192 180 193 if ( $prevpage >= 1 ) { 181 194 printf( 182 195 '<link rel="prev" href="%s">' . "\n", 183 esc_url( get_pagenum_link( $prevpage ))196 esc_url( $prev_url ) 184 197 ); 185 198 } … … 188 201 printf( 189 202 '<link rel="next" href="%s">' . "\n", 190 esc_url( get_pagenum_link( $nextpage ))203 esc_url( $next_url ) 191 204 ); 192 205 }
Note: See TracChangeset
for help on using the changeset viewer.