-1

I have called the wordpress theme header outside wordpress to serve static pages. Unfortunately the Yoast plugin now it is adding the noindex meta tag to those pages, therefore those pages are not indexed by the google bot now can any body help me with this? thanks!

  • 1
    What exactly did you do? Did you just require("..../header.php")? Please show some code. – janh Oct 10 '17 at 17:08
  • This is how the header is called: define('WP_USE_THEMES', false); require($_SERVER['DOCUMENT_ROOT'] . '/wp-blog-header.php'); get_header(); It seems that because the pages that are using these header live outside wordpress then yoast seo identifies them as 404 or search type of page. – Axel Garcia Oct 11 '17 at 18:11
0

You can use the wpseo_robots filter (yoast documentation) to override that. Add something like

add_filter("wpseo_robots", function() { return "index, follow"; });

before calling get_header() to overwrite what wpseo sets. Don't put it in the functions.php of your theme, though, or it will be used on everything in WP.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.