我有wordpress网站,在那里我几乎没有自定义类型的页面。我使用jquery加载加载这些页面的内容。但我不希望这些页面直接可见。所以如果用户转到http://www.domain.com/work/project-name 它是看不见的。或者至少搜索机器人不会索引这些在/工作中的页面/
我用单曲。php为html为页面。我该怎么办?只需拒绝搜索机器人与机器人一起使用即可。txt?我是否可以拒绝用户也去那里,但仍然保持jquery负载正常工作。
谢谢
我有wordpress网站,在那里我几乎没有自定义类型的页面。我使用jquery加载加载这些页面的内容。但我不希望这些页面直接可见。所以如果用户转到http://www.domain.com/work/project-name 它是看不见的。或者至少搜索机器人不会索引这些在/工作中的页面/
我用单曲。php为html为页面。我该怎么办?只需拒绝搜索机器人与机器人一起使用即可。txt?我是否可以拒绝用户也去那里,但仍然保持jquery负载正常工作。
谢谢
在帖子编辑器中添加一个简单的复选框,以切换meta
不允许搜索引擎为您的内容编制索引的字段。然后钩住wp_head
, 检查设置并打印该字段。
插件的示例代码:
add_action( \'post_submitbox_misc_actions\', \'show_noindex_checkbox\' );
add_action( \'save_post\', \'save_noindex\', 10, 2 );
add_action( \'wp_head\', \'insert_noindex_meta\' );
function show_noindex_checkbox()
{
$post_id = get_the_ID();
$name = \'noindex\';
$id = $name . \'_id\';
$value = esc_attr( get_post_meta( $post_id, \'_noindex\', TRUE ) );
$checked = checked( $value, 1, FALSE );
$label = \'Disallow search engine indexing\';
$nonce = wp_nonce_field( \'_noindex\', \'_noindex_nonce\', TRUE, FALSE );
print <<<EOD
<div class="misc-pub-section">
<label for="$id">
<input type="checkbox" $checked id="$id" name="$name" value="1" />
$nonce
$label
</label>
</div>
EOD;
}
function save_noindex( $post_id, $post )
{
if ( wp_is_post_autosave( $post ) )
return;
if ( ! current_user_can( \'edit_post\', $post_id ) )
return;
if ( ! isset ( $_POST[ \'_noindex_nonce\' ] ) )
return;
if ( ! wp_verify_nonce( $_POST[ \'_noindex_nonce\' ], \'_noindex\' ) )
return;
if ( ! isset ( $_POST[ \'noindex\' ] ) )
return delete_post_meta( $post_id, \'_noindex\' );
if ( 1 != $_POST[ \'noindex\' ] )
return;
update_post_meta( $post_id, \'_noindex\', 1 );
}
function insert_noindex_meta()
{
if ( is_singular() and \'1\' !== get_post_meta( get_the_ID(), \'_noindex\', TRUE ) )
wp_no_robots();
}
我的wordpress加载整个jQuery UI库<script type=\'text/javascript\' src=\'http://example.com/wp-includes/js/jquery/ui/jquery.ui.core.min.js?ver=1.9.2\'></script> <script type=\'text/javascript\' src=\'http://example.com/wp-includes/js/jquery/ui/j