You appear to be a bot. Output may be restricted
Description
Override the category link to remove the category base.
Usage
$string = WPSEO_Rewrite::no_category_base( $link, $term, $taxonomy );
Parameters
- $link
- ( string ) required – Term link, overridden by the function for categories.
- $term
- ( WP_Term ) required – Unused, term object.
- $taxonomy
- ( string ) required – Taxonomy slug.
Returns
string
Source
File name: wordpress-seo/inc/class-rewrite.php
Lines:
1 to 23 of 23
public function no_category_base( $link, $term, $taxonomy ) { if ( $taxonomy !== 'category' ) { return $link; } $category_base = get_option( 'category_base' ); if ( empty( $category_base ) ) { $category_base = 'category'; } /* * Remove initial slash, if there is one (we remove the trailing slash * in the regex replacement and don't want to end up short a slash). */ if ( substr( $category_base, 0, 1 ) === '/' ) { $category_base = substr( $category_base, 1 ); } $category_base .= '/'; return preg_replace( '`' . preg_quote( $category_base, '`' ) . '`u', '', $link, 1 ); }