Joshua David Nelson

Bullshit Free WordPress Development

  • Services
  • Code
  • About
  • Contact

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;
}
view raw force_default_genesis_post_meta.php hosted with ❤ by GitHub

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

Tags: Genesis, SEO

Previous Code:
Feedgator RSS Aggregator
Back to the Code Snippets
Next Code:
Remove Genesis Entry Title Link
  • Twitter
  • RSS Feed URL

About Me

I'm a WordPress Engineer. I build sleek, custom websites with WordPress and Genesis.

See my services and my recent work.

Contact me to get your project started.

Gravity Forms Plugin for WordPress Fastest WordPress Hosting

Recent Posts

  • Using Font Awesome Icons for WooCommerce Grid / List Toggle
  • Disable Blog: WordPress Gone Blog-less
  • Category (Taxonomy) Dropdown Filtered By Post Type
  • Weather in WordPress with Dark Sky
  • Fixing Your Deprecated Widget Constructors in WordPress 4.3
  • Twitter
  • RSS Feed URL
  • Code Snippets
  • My Plugins
  • Make a Payment

© Joshua David Nelson | Hand-Forged | WordPress + Genesis | Terms of Service | Legal | Contact