I’m using yoast plugin for seo for the blog wordpress in my site
by default plugin assigns below meta tag for 404 page
<meta name="robots" content="noindex,follow"/>
I want to update this meta tag to the below one
<meta name="robots" content="noindex,nofollow"/>
I have gone through yoast plugin documentation
But didn’t find any solution
Can this be done using yoast plugin itself or Is thee any other way?
2
Answers
In
header.php
file for your WordPress theme you can use the below code which uses the conditional tag , is_404 to check if it is 404 page and prints out themeta
tag which you wish for. So use the options from yoast plugin wherever you need and if you want to change it for specific pages then you can use the conditional tags.The above solution assumes that Yoast Plugin is not adding any meta tags to header. But if Yoast adds it’s own meta tags then you can try the below solution
Add the code to
functions.php
fileIn
frontend/class-frontend.php
of the plugin directory, change the followinginto