Skip to content

Instantly share code, notes, and snippets.

@bobbydank
Last active July 27, 2022 03:29
Show Gist options
  • Save bobbydank/d525a594e65c53e059ca24e638ca9d93 to your computer and use it in GitHub Desktop.
Save bobbydank/d525a594e65c53e059ca24e638ca9d93 to your computer and use it in GitHub Desktop.
simple function for adding extra stuff to your Wordpress site's robots.txt
<?php
/**
* author: Robert Danklefsen
* website: https://www.catchylabs.com/
*
* simple function for adding extra stuff to your Wordpress site's robots.txt
* add to functions.php
*/
function catchylabs_addToRoboText($robotext) {
$additions = "
# Additions
Disallow: /folder/
";
return $robotext . $additions;
}
add_filter('robots_txt', 'catchylabs_addToRoboText');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment