Có thể RankMath đã bỏ quên hoặc không muốn sử dụng chức năng này, họ chỉ có cấu hình xoá tên đường dẫn /category/ mà không hề rút gọn tên chuyên mục cấp 2
Mặc định:

https://tss247.vn/category/chuyen-muc/

Chức năng Strip Category Base sẽ chuyển thành

https://tss247.vn/chuyen-muc-cha/chuyen-muc-con/

Sau khi sử dụng đoạn code bên dưới sẽ trở thành

https://tss247.vn/chuyen-muc-1-cap/

Các bạn cần tạo thêm file rank-math.php hoặc chèn trực tiếp vào functions.php trong theme child nội dung như sau:

Xoá đường dẫn chuyên mục bài viết plugin Rankmath - Xoa duong dan cha chuyen muc bai viet plugin Rankmath

<?php
/**
 * Remove parent slugs from category post URL
 */

add_filter('term_link', function ($link, $term, $taxonomy) {
        if ( $taxonomy !== 'category' ) {
			return $link;
		}
		$category_base = get_option( 'category_base' );
		if ( empty( $category_base ) ) {
			$category_base = 'category';
		}
        if ( '/' === substr( $category_base, 0, 1 ) ) {
            $category_base = substr( $category_base, 1 );
        }
        $category_base .= '/';
        if (RankMath\Helper::get_settings( 'general.strip_category_base' ) == true) {
            $link = home_url( user_trailingslashit( $category_base . $term->slug ) );
        }
        return preg_replace( '`' . preg_quote( $category_base, '`' ) . '`u', '', $link, 1 );
}, 10, 3);

add_filter( 'rewrite_rules_array', function( $rules) {
    global $wp_rewrite;
    wp_cache_flush();
    if (RankMath\Helper::get_settings( 'general.strip_category_base' ) == true) {
        $category_rewrite = array();
        $category_rewrite['(.+?)-cat/?$'] = 'index.php?category_name=$matches[1]';
        $category_rewrite['(.+?)-cat/'.$wp_rewrite->pagination_base.'/?([0-9]{1,})/?$'] = 'index.php?category_name=$matches[1]&paged=$matches[2]';
        $categories = get_categories(array('hide_empty'=>false));
        if ($categories)
        {
            foreach ($categories as $key => $val)
            {
                $posts = get_posts (array("name" => $val->slug));		
                if (!$posts)
                {
                    $category_rewrite['('.$val->category_nicename.')/?$'] = 'index.php?category_name=$matches[1]';
                    $category_rewrite['('.$val->category_nicename.')/'.$wp_rewrite->pagination_base.'/?([0-9]{1,})/?$'] = 'index.php?category_name=$matches[1]&paged=$matches[2]';
                    $category_rewrite['.+?/('.$val->category_nicename.')/?$'] = 'index.php?category_name=$matches[1]';
                    $category_rewrite['.+?/('.$val->category_nicename.')/'.$wp_rewrite->pagination_base.'/?([0-9]{1,})/?$'] = 'index.php?category_name=$matches[1]&paged=$matches[2]';
                }
            }
        }
        return $category_rewrite + $rules;
    }
});

Nguồn tác giả: WPVNTEAM 

Hello!

Tss247

Bạn có thể liên hệ với chúng tôi bằng bất cứ Kênh nào mà bạn có thể trao đổi với chúng tôi

VPĐD: 298 Ngọc Hồi, Thanh Trì, Hà Nội

info@tss247.vn

0866.696.247 - 089.339.247

Nhắn tin qua

Zalo của Tss247

Liên hệ với Tss247 qua Zalo

Gọi ngay Hotline

0866.696.247

Gọi ngay cho Tss247 theo Hotline 0866.696.247
Thông tin khách hàng

Dịch vụ thiết kế website

Dịch vụ Tối ưu Website

Dịch vụ Quản trị Website

Dịch vụ Viết bài chuẩn SEO

Dịch vụ Quảng cáo Google

Dịch vụ Quảng cáo Facebook

Dịch vụ Quảng cáo Zalo

Dịch vụ Quảng cáo Tiktok

Dịch vụ chăm sóc website

Dịch vụ chăm sóc Fanpage

Dịch vụ IT Support/ Helpdesk

Dịch vụ review Google

Dịch vụ Quản trị hệ thống

Dịch vụ Quản trị mạng

Dịch vụ tư vấn giải pháp CNTT

Giải pháp An ninh, camera

Chat with us

Hi there! How can I help you?