Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php代码中添加nofollow和noindex?_Php_Html_Wordpress_Tags - Fatal编程技术网

如何在php代码中添加nofollow和noindex?

如何在php代码中添加nofollow和noindex?,php,html,wordpress,tags,Php,Html,Wordpress,Tags,这是我的代码,如何在社交链接上添加nofollow和noindex <?= wp_nav_menu([ 'menu' => 'social_links', 'menu_class' => 'social-links', 'container' => false, 'echo' => false, 'depth

这是我的代码,如何在社交链接上添加nofollow和noindex

<?= 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" ?>

添加这个&它会很好地工作

header("X-Robots-Tag: noindex, nofollow", true);

您可以使用一个特殊的HTML标记来告诉robots不要为页面内容编制索引,和/或不要扫描页面以查找后续链接

例如:

<html>
<head>
<title>...</title>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
</head>

...

(…)
(…)

您可能需要阅读抱歉,伙计,我没有时间正确书写)反馈:我对没有时间正确书写投了反对票。谢谢,伙计
<!DOCTYPE html>
<html><head>
<meta name="robots" content="noindex, nofollow" />
(…)
</head>
<body>(…)</body>
</html>