Skip to content

Instantly share code, notes, and snippets.

@bahiirwa
Created March 14, 2021 05:12
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 bahiirwa/299b4cb22408e5d53f72f1691205c1d8 to your computer and use it in GitHub Desktop.
Save bahiirwa/299b4cb22408e5d53f72f1691205c1d8 to your computer and use it in GitHub Desktop.
Working with WordPress 5.7 Robots API to add follow
// Remove meta for robots.
// remove_filter( 'wp_robots', 'wp_robots_max_image_preview_large' );
// Replace the values in the meta robot tag.
add_filter( 'wp_robots', 'techiepress_wp_robots_max_image_preview_large' );
// Remove the image preview and add follow to robots
function techiepress_wp_robots_max_image_preview_large( $robots ) {
$robots['max-image-preview'] = false;
$robots['follow'] = true;
var_dump($robots);
return $robots;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment