Sep 01, 2023  

Sometimes WordPress, when upgrading, introduces new sections we do not necessarily need or will use.
There’s a simple code to add that will disable them. (Source Code)

For example, I want to remove the “Do not sell info” section.
So first of all I will be checking what’s the custom post type name for that, by going into the section from the Dashboard and check on the link bar
https://yoursite.com/wp-admin/edit.php?post_type=donotsellrequests

Now the code to add in your theme functions.php

// Deregister Custom Post Type
function delete_post_type(){
unregister_post_type( 'blocks' );
}
add_action('init','delete_post_type');

In this case we will write unregister_post_type( ‘donotsellrequests’ ) as we retrieved the custom post type name from the link.

And that’s it, the block has now disappeared from our Dashboard