bbp_make_first_page_canonical( string $pagination_links = '' )
Remove the first-page from a pagination links result set, ensuring that it points to the canonical first page URL.
Description Description
This is a bit of an SEO hack, to guarantee that the first page in a loop will never have pagination appended to the end of it, regardless of what the other functions have decided for us.
Parameters Parameters
- $pagination_links
-
(Optional) The HTML links used for pagination
Default value: ''
Return Return
(string)
Source Source
File: includes/core/abstraction.php
function bbp_make_first_page_canonical( $pagination_links = '' ) { // Default value $retval = $pagination_links; // Remove first page from pagination if ( ! empty( $pagination_links ) ) { $retval = bbp_use_pretty_urls() ? str_replace( bbp_get_paged_slug() . '/1/', '', $pagination_links ) : preg_replace( '/&paged=1(?=[^0-9])/m', '', $pagination_links ); } // Filter & return return apply_filters( 'bbp_make_first_page_canonical', $retval, $pagination_links ); }
Changelog Changelog
Version | Description |
---|---|
2.6.0 | Introduced. |