• Resolved dewinbrush

    (@dewinbrush)


    Hi, I finalise a new software in Gitlab to update and keep correct versions on each domains. it will be local lingual based web site in each country. So I have many custom post type and taxonomies. I just checked sitemap for last tests on project.

    For exaxmple in Taxonomy sitemaps, I catched this unmatched logic

    English Site:
    software(native) englishsite.com/softwares/blabla
    game(native) englishsite.com/games/blabla
    offer(native) englishsite.com/offers/blabla

    I built system as custom post type/taxonomy and name strings to define custom words in local language

    it is converting to for example Turkish:

    software(native) turkishsite.com/yazilim/blabla
    game(native) turkishsite.com/oyun/blabla
    offer(native) turkishsite.com/teklif/blabla

    eventhough we changed slugs, sitemap base native slugs are not changed.

    it shows like this

    sitemap_index.xml -> (at base,native slugs of Taxonomy and posts shown)

    turkishsite.com/software-sitemap.xml ->(when click) turkishsite.com/’yazilim’/blahblah

    at base, system still shows base native slugs, when i click sitemap categories in sitemap_index.xml, yoast bings correct CPT slug with category or posts in second levels of Custom Taxonomies (or posts). why the base is shows all the time native slugs? How arabian, japanese, korean or chinese will solve this problem?

    what is the logic behind it?

    • This topic was modified 5 years, 6 months ago by dewinbrush.
Viewing 11 replies - 1 through 11 (of 11 total)
  • Method get_index_links uses get_taxonomies to retrieves all taxonomies. Taxonomy subsitemaps use get_term. Is the question related to links in sub sitemaps? Can you make some screenshot?

    Plugin Support Maybellyne

    (@maybellyne)

    [deleted_post]

    Thread Starter dewinbrush

    (@dewinbrush)

    [deleted_post] = ? what is meaning?

    Plugin Support Maybellyne

    (@maybellyne)

    Hello,

    The previous post was deleted because someone else responded to you, requesting more details to give some context to the issue described.

    Thread Starter dewinbrush

    (@dewinbrush)

    @stodorovic

    1- [img]https://i.imgur.com/AFtxtNR.jpg[/img]
    as you can see changed Slugs for native languages that we are changing

    2- [img]https://i.imgur.com/Vd1J1cY.jpg[/img]
    that sitemap_index shows still native slugs

    3-[img]https://i.imgur.com/x5TtZfy.jpg[/img]
    when you click native sitemap type.xml it shows correct slugs of defined CPT slug

    second steps base sitemap_index.xml in my view not correct

    Thread Starter dewinbrush

    (@dewinbrush)

    @maybellyne

    I just want to understand its logic. Am I wrong? Or is this a seo plugin and am I wrong in the section that should support seo? After all, I’ve been using yoast on every site for over 3 years. Moreover, there are about 30 sites where we use the pro version and the sites that I have made are used by people. I am currently seeing the same problem with each of them I never faced this issue before

    • This reply was modified 5 years, 6 months ago by dewinbrush.
    Plugin Support Maybellyne

    (@maybellyne)

    Hello,

    The issue is still not clear. Do you mean the CPT is oyun but you changed it to software then oyun still shows up in the individual sitemap?

    So, I see two separate issues if I’m correct.

    First is related to get_taxonomies. There are two “slugs”:

    • First argument of register_taxonomy It’s in a link to particular sub sitemap. You can’t change a link of particular sub-sitemap in sitemap index (same as post or page).
    • ['rewrite']['slug'] of third argument – register_taxonomy (it’s probably your translated slug) which isn’t same as previous slug. It’s “slug” in particular sub-sitemap (and links on the frontend).

    Second issue is probably related to get_term which should use different slugs depends on HTTP_HOST. It’s possible that 3rd plugin (or eg. Divi theme) enable transient caching which isn’t compatible if you have more domain names.

    It works fine with WPML. So, you should see different software-sitemap.xml depends on request URL (but turkishsite.com/yazilim-sitemap.xml isn’t valid).

    Thread Starter dewinbrush

    (@dewinbrush)

    @maybellyne

    I’m using variables to change default CPT in WP with OPTON ADMIN page for redefine titles and slugs. I guess you didn’t check screenshots.

    1- please Check first

    View post on imgur.com

    you will see software-sitemap.xml (eventhough i redefined slug, default slug(s) are brought by yoast in main sitemap_index.xml page instead of redefined slugs)

    2- and please check this screenshot.

    View post on imgur.com

    at second images, please check PERMALINK on Browser and see the Sitemap permalinks with yellow circles.

    this result is when i click software-sitemap.xml (has to be ‘oyun’ because i redifened it and all permalinks xyz.com/oyun/abc not xyz.com/sotware/abc)

    and let me know what is wrong between two screenshots

    @stodorovic

    I guess code is clean, tell me is there any wrong logic? her the just one taxonomy variable.

    /* — Add custom slug for taxonomy ‘software’ — */

    if ( get_option( ‘cpt_software_slug’) ) {

    function change_cpt_game_software_slug( $taxonomy, $object_type, $args ) {

    if ( get_option( ‘cpt_software_slug’) ) {
    $cpt_software_slug = get_option( ‘cpt_software_slug’, ‘software’ );
    } else {

    $cpt_software_slug = ‘software’;
    }

    if( ‘software’ == $taxonomy ) {
    remove_action( current_action(), __FUNCTION__ );
    $args[‘rewrite’] = array( ‘slug’ => $cpt_software_slug );
    register_taxonomy( $taxonomy, $object_type, $args );
    }

    }
    add_action( ‘registered_taxonomy’, ‘change_cpt_game_software_slug’, 10, 3 );

    }

    Already permalinks and internal pages works correctly. Just problem is Yoast not detect defined taxonomy names or slugs, but yoast brings defined permalinks şb sitemap_index.xml under the CPT types

    I guess Yoast logic on registered taxonomy with ‘register_taxonomy’

    register_taxonomy(‘software’, ‘games’, $args);

    • This reply was modified 5 years, 6 months ago by dewinbrush.
    • This reply was modified 5 years, 6 months ago by dewinbrush.
    • This reply was modified 5 years, 6 months ago by dewinbrush.

    It’s pretty complex code and it can make side effects. I think that you should use hook register_taxonomy_args to override only slug before WP core create taxonomy (without calling remove_action and register_taxonomy).

    Other issue that “rewrite rules” should be flushed after each change of slug options. More details – https://developer.ww.wp.xz.cn/reference/functions/flush_rewrite_rules/

    If you want to replace sub-sitemap’s links then you need to use register_taxonomy('yazilim', 'oyun',$args); but then it’s different taxonomy. It isn’t SEO issue because it’s internal link which SE (Search Engine) only parse. It’s similar logic in other SEO plugins. You can use wpseo_sitemap_index_links to override links in sitemap index, but then you need very complex rewrite rules to handle sub-sitemaps. Again, it doesn’t affect SEO and it isn’t shown outside internal WP logic (and GSC sitemap’s panel for example).

    Thread Starter dewinbrush

    (@dewinbrush)

    @stodorovic

    your comment is pretty amateur. you don’t have any idea what I shared with you.

    Anyway, I solved the problem.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Custom Post Type sitemap problem’ is closed to new replies.