use post meta in add_meta_boxes action
You can not put condition in callback function as it will display the meta box without the HTML. Better you can wrap add_meta_box() in if condition. If you are on post edit screen you can get the post id in this way. $post_id = false; if (!empty($_POST[‘post_ID’])) { $post_id = $_POST[‘post_ID’]; } else if (!empty($_GET[‘post’])) … Read more