Force Genesis Post SEO Settings

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.

<?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;
}

Source: https://gist.github.com/joshuadavidnelson/7443626

Tags: ,