This bit in your functions.php file will force specific settings for robots post meta. Change 'post' to a specific post type or replace with other conditional. This is handy for post types that you do not want to have single post pages included in search results, private pages, et cetera.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* Force Default Robot Options on Post Type ('post' in this case) | |
* | |
* @author: Joshua Nelson | |
* @link: http://joshuadnelson.com | |
* | |
*/ | |
add_filter( 'get_post_metadata', 'jdn_robot_defaults', 10, 4 ); | |
function jdn_robot_defaults( $meta_value, $post_id, $meta_key, $single ) { | |
if( get_post_type( $post_id ) == 'post' ) { | |
if( '_genesis_noindex' == $meta_key ) // set checkbox | |
$meta_value = 1; | |
if( '_genesis_nofollow' == $meta_key ) // set checkbox | |
$meta_value = 1; | |
if( '_genesis_noarchive' == $meta_key ) // set checkbox | |
$meta_value = 1; | |
} | |
return $meta_value; | |
} |