Support » Plugin: Multiple Domain » remove hreflang tag

  • Resolved crmb

    (@crmb)


    Hello,
    What is the correct way to remove the alternate/hreflang tag ? I am not sure how to remove it with remove_filter()
    It display the primary domain name url and i don’t want that.
    (the lang selects are all set to “None”)
    Thanks

    • This topic was modified 7 months, 1 week ago by  crmb.
Viewing 3 replies - 1 through 3 (of 3 total)
  • answering myself :

    function remove_multipledomain_hreflang(){
      global $multipleDomain;
      remove_action('wp_head', array($multipleDomain, 'addHrefLangHeader'));	
    }
    add_action('init', 'remove_multipledomain_hreflang');
    • This reply was modified 7 months, 1 week ago by  crmb.
    Plugin Author Gustavo Straube

    (@gustavostraube)

    @crmb That’s nice you found a way to handle that. I’ll add your solution to the plugin’s FAQ. I’d just change one thing since $multipleDomain variable is not global by default:

    function remove_multipledomain_hreflang()
    {
        if (!class_exists('MultipleDomain')) {
            return;
        }
        $multipleDomain = MultipleDomain::instance();
        remove_action('wp_head', array($multipleDomain, 'addHrefLangHeader'));	
    }
    add_action('init', 'remove_multipledomain_hreflang');

    I also added a condition to make sure the plugin is active.

    crmb

    (@crmb)

    Thank you.

    By the way, something broke starting 0.11 with ajax.
    I am trying to troubleshoot. Maybe something like MULTPLE_DOMAIN_DOMAIN not set when using ajax. Still trying to understand.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘remove hreflang tag’ is closed to new replies.