y->cat_ID ) { // Recursive recursion. $category->parent = 0; } elseif ( $taxonomy->rewrite['hierarchical'] !== false && $category->parent !== 0 ) { $parents = get_category_parents( $category->parent, false, '/', true ); if ( ! is_wp_error( $parents ) ) { $category_nicename = $parents . $category_nicename; } unset( $parents ); } $category_rewrite = $this->add_category_rewrites( $category_rewrite, $category_nicename, $blog_prefix, $wp_rewrite->pagination_base ); // Adds rules for the uppercase encoded URIs. $category_nicename_filtered = $this->convert_encoded_to_upper( $category_nicename ); if ( $category_nicename_filtered !== $category_nicename ) { $category_rewrite = $this->add_category_rewrites( $category_rewrite, $category_nicename_filtered, $blog_prefix, $wp_rewrite->pagination_base ); } } unset( $categories, $category, $category_nicename, $category_nicename_filtered ); } // Redirect support from Old Category Base. $old_base = $wp_rewrite->get_category_permastruct(); $old_base = str_replace( '%category%', '(.+)', $old_base ); $old_base = trim( $old_base, '/' ); $category_rewrite[ $old_base . '$' ] = 'index.php?wpseo_category_redirect=$matches[1]'; return $category_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. * * @return array The added set of rules. */ protected function add_category_rewrites( $rewrites, $category_name, $blog_prefix, $pagination_base ) { $rewrite_name = $blog_prefix . '(' . $category_name . ')'; global $wp_rewrite; $feed_regex = '(' . implode( '|', $wp_rewrite->feeds ) . ')'; $rewrites[ $rewrite_name . '/(?:feed/)?' . $feed_regex . '/?$' ] = 'index.php?category_name=$matches[1]&feed=$matches[2]'; $rewrites[ $rewrite_name . '/' . $pagination_base . '/?([0-9]{1,})/?$' ] = 'index.php?category_name=$matches[1]&paged=$matches[2]'; $rewrites[ $rewrite_name . '/?$' ] = 'index.php?category_name=$matches[1]'; return $rewrites; } /** * Walks through category nicename and convert encoded parts * into uppercase using $this->encode_to_upper(). * * @param string $name The encoded category URI string. * * @return string The convered URI string. */ protected function convert_encoded_to_upper( $name ) { // Checks if name has any encoding in it. if ( strpos( $name, '%' ) === false ) { return $name; } $names = explode( '/', $name ); $names = array_map( [ $this, 'encode_to_upper' ], $names ); return implode( '/', $names ); } /** * Converts the encoded URI string to uppercase. * * @param string $encoded The encoded string. * * @return string The uppercased string. */ public function encode_to_upper( $encoded ) { if ( strpos( $encoded, '%' ) === false ) { return $encoded; } return strtoupper( $encoded ); } /** * Redirect the "old" category URL to the new one. * * @codeCoverageIgnore * * @param string $category_redirect The category page to redirect to. * @return void */ protected function redirect( $category_redirect ) { $catlink = trailingslashit( get_option( 'home' ) ) . user_trailingslashit( $category_redirect, 'category' ); wp_safe_redirect( $catlink, 301, 'Yoast SEO' ); exit; } }
Fatal error: Uncaught Error: Class 'WPSEO_Rewrite' not found in /var/www/html/alertamt.com.br/web/wp-content/plugins/wordpress-seo/wp-seo-main.php:352 Stack trace: #0 /var/www/html/alertamt.com.br/web/wp-includes/class-wp-hook.php(324): wpseo_init('') #1 /var/www/html/alertamt.com.br/web/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #2 /var/www/html/alertamt.com.br/web/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #3 /var/www/html/alertamt.com.br/web/wp-settings.php(559): do_action('plugins_loaded') #4 /var/www/html/alertamt.com.br/web/wp-config.php(115): require_once('/var/www/html/a...') #5 /var/www/html/alertamt.com.br/web/wp-load.php(50): require_once('/var/www/html/a...') #6 /var/www/html/alertamt.com.br/web/wp-blog-header.php(13): require_once('/var/www/html/a...') #7 /var/www/html/alertamt.com.br/web/index.php(17): require('/var/www/html/a...') #8 {main} thrown in /var/www/html/alertamt.com.br/web/wp-content/plugins/wordpress-seo/wp-seo-main.php on line 352