Created
August 16, 2018 12:28
-
-
Save hereswhatidid/6299ee9e34e1a2034cf7504dc292da4d to your computer and use it in GitHub Desktop.
Disable Yoast fields on a custom post type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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