I have searched left, right and center and believe that this does not exist as a built in option in WordPress; is there any way to, problematically, display (or not) a metabox in a custom post type edit screen depending on the content of a metakey value?
The only idea i have is to display the content of the metakey in a hidden field, retrieving it’s value with jQuery and based on its content deleting the div containing the metabox pr not.
The content of the metabox is quite resource intensive so i am looking for another solution.
Of course…
The
add_meta_boxes*
hooks pass the$post
variable, so use it to check the meta key in question and conditionally add the meta box. There is a genericadd_meta_boxes
hook that always runs, but otheradd_meta_boxes_CPTSLUG
hooks that are limited to particular post types. My example applies only to pages.If your content is a resource intensive as you say, I’d look into transients.