Viewing 1 replies (of 1 total)
  • Plugin Author Derek Herman

    (@valendesigns)

    I use this inside my meta box file to get the post ID.

    $post_id = isset( $_GET['post'] ) ? $_GET['post'] : ( isset( $_POST['post_ID'] ) ? $_POST['post_ID'] : 0 );

    You can then get information about the post like it’s slug, template etc. once you know the ID. Then you need to wrap ot_register_meta_box with an if statement that only executes that meta box if you are viewing whatever it is you are trying to limit that meta box to. The one caveat of this method is that the page template is not known initially, so the meta box will not show until after you have saved the page for the first time.

Viewing 1 replies (of 1 total)
  • The topic ‘Display metabox only on specific page template editor screen’ is closed to new replies.