Skip to content

Instantly share code, notes, and snippets.

@joshuadavidnelson
Created November 13, 2013 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshuadavidnelson/7443626 to your computer and use it in GitHub Desktop.
Save joshuadavidnelson/7443626 to your computer and use it in GitHub Desktop.
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