Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cameronjonesweb/ea7befc6e377d894f07b0ca5c40423b8 to your computer and use it in GitHub Desktop.
Save cameronjonesweb/ea7befc6e377d894f07b0ca5c40423b8 to your computer and use it in GitHub Desktop.
Adds the Yoast SEO webmaster tools (and other sites) verification codes to all pages including the login page. This is helpful when running a membership site or similar that requires users being logged in to view the site.
<?php
add_action( 'init', 'cameronjonesweb_yoast_front_page_head' );
function cameronjonesweb_yoast_front_page_head() {
if ( class_exists( 'WPSEO_Frontend' ) ) {
add_action( 'wpseo_head', array( WPSEO_Frontend::get_instance(), 'webmaster_tools_authentication' ), 90 );
add_action( 'login_head', array( WPSEO_Frontend::get_instance(), 'webmaster_tools_authentication' ), 90 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment