Toggle admin metabox based upon chosen page template
The best way to approach this situation is via JavaScript. That way, whenever the selected value changes, you can instantly hide/show the related metabox. Use wp_enqueue_script() in functions.php to load a custom JavaScript file in the admin area: add_action(‘admin_enqueue_scripts’, ‘my_admin_script’); function my_admin_script() { wp_enqueue_script(‘my-admin’, get_bloginfo(‘template_url’).’/my-admin.js’, array(‘jquery’)); } The script itself, which requires jQuery, simply hides … Read more