Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.