Is it possible to find and replace html tags in header with a function?
Here's what I need to do:
I'm using wpseo plugin and I set default to no index subpages of archives.
But I have some categories where I would like to have sub-pages indexed and the plugin adds the noindex
tag to them all.
Therefore, I need to find this tag <meta name="robots" content="noindex,follow">
and replace it with <meta name="robots" content="index,follow">
ONLY on those especific categories.
ie:
// First I need to get the url
$url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
// Now I will check if I'm on category and if current url has the word "page"
// This way, I know I'm on the next pages of the category
if (is_category(array(561) && strpos($url,'page') !== false)) {
// If I'm on paged content of category 561
=> FIND THIS: <meta name="robots" content="noindex,follow">
=> REPLACE WITH: <meta name="robots" content="index,follow">';
How can I do this?