Skip to content

Instantly share code, notes, and snippets.

@hereswhatidid
Created August 16, 2018 12:28
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 hereswhatidid/6299ee9e34e1a2034cf7504dc292da4d to your computer and use it in GitHub Desktop.
Save hereswhatidid/6299ee9e34e1a2034cf7504dc292da4d to your computer and use it in GitHub Desktop.
Disable Yoast fields on a custom post type
<?php
/*
* This class will disable Yoast SEO fields on the edit screen for a particular post type
*/
namespace HWID\CustomPostType;
class DisableYoast {
static function init() {
// The important aspect of this add_action is to make sure it's set to at least 11 in priority
add_action( 'add_meta_boxes', [ 'HWID\CustomPostType\Expertise', 'remove_yoast' ], 11 );
}
static function remove_yoast() {
remove_meta_box( 'wpseo_meta', 'POST_TYPE_SLUG', 'normal' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment