Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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.
<?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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.