Access the environment of an admin page from another admin page

Ok, this could be achieved this way, probably.

add_action('add_meta_boxes_my_super_duper_post_type', 'get_metabox_global_ajax', 9999 );
function get_metabox_global_ajax(){
    if( isset($_GET['mgv']) && $_GET['mgv'] == '1' ){
        global $wp_meta_boxes;
        @error_reporting( 0 );
        header( 'Content-type: application/json' );
        die( json_encode( $wp_meta_boxes ));
    }
}

Now, you send a request from your plugin page to post-new.php?post_type=my_super_duper_post_type&mgv=1 through ajax, and use the returned json response of wp_meta_boxeses variables.

Leave a Comment