• Resolved docbt

    (@docbt)


    Hi guys!

    I am getting 3 open graph duplicates with ultimate member plugin.

    og:title
    og:url
    og:image

    The reason is that Yoast and UM both are adding the tags to the member profile pages.

    Yoast adds the title and URL of the parent URL segment to all member profile pages.
    e.g. https://example.com/memberprofile/ instead of https://example.com/memberprofile/123
    and “Users | Sitename” instead of “Username | Sitename”

    The UM tags are correct…

    Is it possible to deactivate the yoast open graph feature for all profile pages with a filter?

    Thanks in advance!

    • This topic was modified 5 years, 3 months ago by docbt.
Viewing 1 replies (of 1 total)
  • Thread Starter docbt

    (@docbt)

    Solved it myself ??

    This will remove the URL, Title an Type element added by yoast on UM profile pages.

    
    // Yoast - wpseo
    add_filter( 'wpseo_opengraph_url', 'filter_wpseo_opengraph_url', 10, 1 );
    function filter_wpseo_opengraph_url( $url ) { 
        if( function_exists('um_is_core_page') ){
            if ( um_is_core_page('user')  && um_get_requested_user() ) {     			
          		return;
            } else {
                return $url;
            }
        } else {
            return $url;
        }
    };
    add_filter( 'wpseo_opengraph_title', 'filter_wpseo_opengraph_title', 10, 1 );  
    function filter_wpseo_opengraph_title( $title ) { 
        if( function_exists('um_is_core_page') ){
            if ( um_is_core_page('user')  && um_get_requested_user() ) {		
          		return;
            } else {
                return $title;
            }
        } else {
            return $title;
        }
    };
    add_filter( 'wpseo_opengraph_type', 'yoast_change_opengraph_type', 10, 1 );    
    function yoast_change_opengraph_type( $type ) {  
        if( function_exists('um_is_core_page') ){
            if ( um_is_core_page('user')  && um_get_requested_user() ) {     			
          		return;
            } else {
                return $type;
            }
        } else {
            return $type;
        }
    };
Viewing 1 replies (of 1 total)
  • The topic ‘Open Graph duplicates with Ultimate Member’ is closed to new replies.