The $post variable – Did I get the grasp of how the Backend actions get parsed?
As I’ve already wrote in question comments, at the very beginning of creating the new post or page first choose a template and save as draft. Meta box will appear after save if right template is used. <?php add_action( ‘add_meta_boxes’, ‘my_add_meta_box’ ); function my_add_meta_box() { // get template file name $template_basename = wp_basename( get_page_template() ); … Read more