plugin updates
This commit is contained in:
@@ -71,9 +71,9 @@ class WPSEO_Rewrite {
|
||||
/**
|
||||
* Update the query vars with the redirect var when stripcategorybase is active.
|
||||
*
|
||||
* @param array $query_vars Main query vars to filter.
|
||||
* @param array<string> $query_vars Main query vars to filter.
|
||||
*
|
||||
* @return array
|
||||
* @return array<string> The query vars.
|
||||
*/
|
||||
public function query_vars( $query_vars ) {
|
||||
if ( WPSEO_Options::get( 'stripcategorybase' ) === true ) {
|
||||
@@ -86,9 +86,9 @@ class WPSEO_Rewrite {
|
||||
/**
|
||||
* Checks whether the redirect needs to be created.
|
||||
*
|
||||
* @param array $query_vars Query vars to check for existence of redirect var.
|
||||
* @param array<string> $query_vars Query vars to check for existence of redirect var.
|
||||
*
|
||||
* @return array|void The query vars.
|
||||
* @return array<string> The query vars.
|
||||
*/
|
||||
public function request( $query_vars ) {
|
||||
if ( ! isset( $query_vars['wpseo_category_redirect'] ) ) {
|
||||
@@ -96,12 +96,13 @@ class WPSEO_Rewrite {
|
||||
}
|
||||
|
||||
$this->redirect( $query_vars['wpseo_category_redirect'] );
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* This function taken and only slightly adapted from WP No Category Base plugin by Saurabh Gupta.
|
||||
*
|
||||
* @return array
|
||||
* @return array<string> The category rewrite rules.
|
||||
*/
|
||||
public function category_rewrite_rules() {
|
||||
global $wp_rewrite;
|
||||
@@ -112,8 +113,10 @@ class WPSEO_Rewrite {
|
||||
$permalink_structure = get_option( 'permalink_structure' );
|
||||
|
||||
$blog_prefix = '';
|
||||
if ( is_multisite() && ! is_subdomain_install() && is_main_site() && strpos( $permalink_structure, '/blog/' ) === 0 ) {
|
||||
$blog_prefix = 'blog/';
|
||||
if ( strpos( $permalink_structure, '/blog/' ) === 0 ) {
|
||||
if ( ( is_multisite() && ! is_subdomain_install() ) || is_main_site() || is_main_network() ) {
|
||||
$blog_prefix = 'blog/';
|
||||
}
|
||||
}
|
||||
|
||||
$categories = get_categories( [ 'hide_empty' => false ] );
|
||||
@@ -156,12 +159,12 @@ class WPSEO_Rewrite {
|
||||
/**
|
||||
* Adds required category rewrites rules.
|
||||
*
|
||||
* @param array $rewrites The current set of rules.
|
||||
* @param string $category_name Category nicename.
|
||||
* @param string $blog_prefix Multisite blog prefix.
|
||||
* @param string $pagination_base WP_Query pagination base.
|
||||
* @param array<string> $rewrites The current set of rules.
|
||||
* @param string $category_name Category nicename.
|
||||
* @param string $blog_prefix Multisite blog prefix.
|
||||
* @param string $pagination_base WP_Query pagination base.
|
||||
*
|
||||
* @return array The added set of rules.
|
||||
* @return array<string> The added set of rules.
|
||||
*/
|
||||
protected function add_category_rewrites( $rewrites, $category_name, $blog_prefix, $pagination_base ) {
|
||||
$rewrite_name = $blog_prefix . '(' . $category_name . ')';
|
||||
|
||||
Reference in New Issue
Block a user