Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. add_action('wp_head', function() {
  2. ob_start();
  3. }, 0);
  4.  
  5. add_action('wp_head', function() {
  6. $siteHeaderOutput = ob_get_clean();
  7.  
  8. // just a variable that i'll be using in a transient
  9. $siteHasNoIndex = "not set";
  10.  
  11. if (strpos($siteHeaderOutput, 'noindex') !== false) {
  12. $siteHasNoIndex = "no index";
  13. } else {
  14. $siteHasNoIndex = "index ready";
  15. }
  16.  
  17. // echo the header
  18. echo $siteHasNoIndex;
  19.  
  20. // then set a transient for the admin panel
  21. set_transient('escode_has_index', $siteHasNoIndex, DAY_IN_SECONDS);
  22. }, PHP_INT_MAX);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement