Skip to content

Instantly share code, notes, and snippets.

@usingthesystem
Last active November 3, 2016 10:31
Show Gist options
  • Save usingthesystem/3ed5b392805dd902e2cedb5600beb5d7 to your computer and use it in GitHub Desktop.
Save usingthesystem/3ed5b392805dd902e2cedb5600beb5d7 to your computer and use it in GitHub Desktop.
robotsTxtDisallowOnDevEnv.php
<?php
add_filter( 'robots_txt', NS . 'customRobotsTxt', 10, 2 );
function customRobotsTxt($output, $public) {
if(WP_ENV == 'production') {
return $output;
} else {
return "User-agent: *\nDisallow: /";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment