To exclude search bots you can add to your theme function.php:
function gmedia_post_noindex(){
global $post;
if(is_single() && 'gmedia' == substr($post->post_type, 0, 6)){
global $gmDB;
if('gmedia' == $post->post_type){
$obj_id = get_post_meta($post->ID, '_gmedia_ID', true);
} else{
$obj_id = get_post_meta($post->ID, '_gmedia_term_ID', true);
}
$noindex = $gmDB->get_metadata('gmedia', $obj_id, 'noindex', true);
if($noindex){
echo '<meta name="robots" content="noindex,nofollow" />';
}
}
}
add_action('wp_head', 'gmedia_post_noindex');
Then add custom field “noindex” with any value to Gmedia items which you want to exclude from indexing.
OR
you can add code below to automatically exclude from indexing any posts which have ‘exclude_’ in the name:
function noindex_by_post_name(){
global $post;
if(is_single() && 'exclude_' == substr($post->post_name, 0, 8)){
echo '<meta name="robots" content="noindex,nofollow" />';
}
}
add_action('wp_head', 'noindex_by_post_name');