Created
March 30, 2016 19:58
-
-
Save jtcote/8d7e4d3731e61781223bac49e4411371 to your computer and use it in GitHub Desktop.
Set WP Admin > Settings > Reading robots access
//* Discourage search engines from indexing this site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Discourage search engines from indexing this site | |
add_action('init', 'gumtheme_set_robots_access'); | |
function gumtheme_set_robots_access(){ | |
if(WP_ENV == 'staging' && get_option('blog_public') == '1') | |
update_option('blog_public', '0'); | |
if(WP_ENV == 'production' && get_option('blog_public') == '0') | |
update_option('blog_public', '1'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment