How to add nofollow and noindex in php code?
How to add nofollow and noindex in php code?
This is my code, how can I add nofollow and noindex on social links?
<?= wp_nav_menu([
'menu' => 'social_links',
'menu_class' => 'social-links',
'container' => false,
'echo' => false,
'depth' => 1,
'items_wrap' => '<ul class="%2$s">%3$s</ul>',
'item_spacing' => 'discard',
'link_before' => '',
'link_after' => '',
]) . "n" ?>
sorry mate, i didnt have time to wrote correctly)
– Quick Becko
Jun 29 at 10:00
Feedback: I have downvoted for not having time to write correctly.
– halfer
yesterday
2 Answers
2
Add this & it will work fine.
header("X-Robots-Tag: noindex, nofollow", true);
Where i must add this code?
– Quick Becko
Jun 29 at 9:42
You can use a special HTML tag to tell robots not to index the content of a page, and/or not scan it for links to follow.
For Example :
<html>
<head>
<title>...</title>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
</head>
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
you may need to read stackoverflow.com/help/how-to-ask
– Shihe Zhang
Jun 29 at 9:52