Adding Google Search Console Verification

This topic has 4 replies, 3 voices, and was last updated 6 years, 2 months ago ago by Rose Tyler

  • Avatar: jsantnar
    jsantnar
    Participant
    October 22, 2018 at 18:06

    I’d like to verifiy my company store site without having to add yet another plugin.

    I tried adding this code to the child functions.php but it’s not working (I replaced the verification id with some dummy text).

    function etheme_add_gsc_meta_tag(){
    if( ! is_home() || ! is_front_page() ) return;
    	#replace your meta tag below
    	echo '<meta name="google-site-verification" content="MYGSC-ID######" />';	
    }
    add_action( 'wp_head', 'etheme_add_gsc_meta_tag' );
    

    Can you help me? THANKS!

    3 Answers
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    October 23, 2018 at 09:39

    Hello,

    Use

    function etheme_add_gsc_meta_tag(){
    if( ! is_front_page() ) return;
    	#replace your meta tag below
    	echo '<meta name="google-site-verification" content="MYGSC-ID######" />';	
    }
    add_action( 'wp_head', 'etheme_add_gsc_meta_tag' );

    Regards

    Avatar: jsantnar
    jsantnar
    Participant
    October 23, 2018 at 16:40

    Worked like a charm! Thank you!

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    October 24, 2018 at 07:11

    Hello,

    You’re welcome!

    Regards

  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.