delarge
12/7/2017 - 12:13 AM

remove Yoast stuff

Includes removing yoast panels from custom post types

<?php
// =================================================================
// ====== Yoast SEO
// =================================================================


// move Yoast box to the bottom in admin pages
add_filter( 'wpseo_metabox_prio', function() { return 'low';});

// remove Yoast columns from admin
add_filter( 'wpseo_use_page_analysis', '__return_false' );


// remove Yoast HTML comments
// https://gist.github.com/paulcollett/4c81c4f6eb85334ba076
if (defined('WPSEO_VERSION')) {
  add_action('wp_head',function() { ob_start(function($o) {
  return preg_replace('/^\n?<!--.*?[Y]oast.*?-->\n?$/mi','',$o);
  }); },~PHP_INT_MAX);
}

// remove dashboard widget
// Remove dashboard widget
add_action('wp_dashboard_setup', 'remove_wpseo_dashboard_overview' );
function remove_wpseo_dashboard_overview() {
  // In some cases, you may need to replace 'side' with 'normal' or 'advanced'.
  remove_meta_box( 'wpseo-dashboard-overview', 'dashboard', 'normal' );
}



// remove yoast panels from testimonials / post type
function remove_yoast_metabox_reservations(){
    remove_meta_box('wpseo_meta', 'testimonial', 'normal');
}
add_action( 'add_meta_boxes', 'remove_yoast_metabox_reservations',11 );
?>