Inspired by Modify the robots.txt file from wpvip.com
/**
* Custom robots.txt
*/
if ( ! function_exists( 'custom_robotstxt' ) ) :
function custom_robotstxt() {
echo "User-agent: MJ12bot" . PHP_EOL;
echo "Disallow: /" . PHP_EOL;
}
add_action( 'do_robotstxt', 'custom_robotstxt' );
endif;