Pages not indexed due to redirection on RankMath Sitemap

[ad_1]

This is happening an all category pages apparently due to a redirection set on the sitemap. Do note I’m not using the build in “Strip Category Base” from RankMath, But instead the following code to strip it.

function modify_category_link_defaults_proyectos($termlink, $term_id) {
    $ancestors = get_ancestors( $term_id, 'category' );
    $parent_cat = array_values(array_slice($ancestors, -1));
    $term = get_term_by('id', $term_id, 'category');

    if ((empty($ancestors)) && ($term->slug == 'proyectos')) {
      $base = get_bloginfo('wpurl');
      $termlink = $base . "/" . $term->slug;
      return $termlink;      
    }
    elseif ((empty($ancestors)) && !($term->slug == 'proyectos')) {
      return $termlink;
    }
    elseif ($parent_cat[0] == 3) {
      $base = get_bloginfo('wpurl');
      $termlink = $base . "/" . $term->slug;
      return $termlink;
    }
    else {
      return $termlink;
    }

}

add_filter( "category_link", "modify_category_link_defaults_proyectos", 10, 2 );

I did try deactivating this code on functions.php and using the above RankMath preference but it didn’t achieve the same, I could still see the categories with “/proyectos/” in the url (the idea is to only have the post category name).

The page I need help with: [log in to see the link]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer