Viewing 3 replies - 1 through 3 (of 3 total)
  • @carlosmdlf

    I have made some changes to the old code snippet and you can try this version and replace both old functions with this code:

    add_filter( 'the_seo_framework_sitemap_additional_urls', 'the_seo_framework_sitemap_additional_um_urls', 10, 1);
    
    function the_seo_framework_sitemap_additional_um_urls ( $custom_urls = [] ) {
    
        if( ! function_exists( 'UM' )) return $custom_urls;
    
        $users = get_users();
       
        foreach( $users as $user ){
            $user_profile_slug = UM()->user()->get_profile_link( $user->ID );
            $um_last_update = get_user_meta( $user->ID, "um_last_update", true );
            if( $um_last_update ) {
                $custom_urls[$user_profile_slug] = ['lastmod' => date( 'Y-m-d H:i:s', $um_last_update )];
            } else {
                $custom_urls[$user_profile_slug] = ['lastmod' => $user->user_registered];
            }
        }
        return $custom_urls;
    }

    Install by adding to your active theme’s functions.php file
    or use the “Code Snippets” plugin.

    https://www.ads-software.com/plugins/code-snippets/

    • This reply was modified 2 years, 2 months ago by missveronica.
    • This reply was modified 2 years, 2 months ago by missveronica.
    Thread Starter carlosmdlf

    (@carlosmdlf)

    Hi @missveronicatv thanks a lot for your answer. I found another way around it I think might be usufell for other UM users. What I did was to change all of my users roles from Subscriber, to Author. Then I was able to index them in the XML author map provided by Yoast Seo. I think this is a simpler solution that provides more protection against future updates, since obviously the snippet aproach got some update issues. Thanks a lot for the code though, will test it if something goes wrong in the future with my current solution.

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @carlosmdlf

    Thank you for letting us know how you’ve resolved the issue.

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Indexing User Profiles in XML Sitemap’ is closed to new replies.