get $post (object,parts/values) in meta-box

I want to know, how to get i.e. $post ID, TITLE and etc.. in metabox?

is other solution available, instead of $GLOBALS['post'] ?

Solutions Collecting From Web of "get $post (object,parts/values) in meta-box"

Do not rely on globals like get_the_ID() or get_post() do. Use the parameters for your callbacks.

You get the current post object twice:

  1. When you register the metabox, you get the post object as a second parameter.
  2. When your output callback is called, you get it as the first parameter.

Here is an example showing both cases:

add_action( 'add_meta_boxes', function( $post_type, \WP_Post $post ) {
        'test', // handle
        'Box title', // title
        function( \WP_Post $post ) { // output
            print get_the_title( $post );

Just go with what the API provides (the global $post object refers to the post that is set up via the main query loop setup_postdata() function):

$post = get_post( get_the_ID() );

All other API functions also refer to the $_GLOBALS['post'] variable and the global $wp_query (and respectively the global $wp_the_query) vars. Just call get_the_title(), etc. and you are good. Sidenote: All this is cached per default, so repetitive calls do not hurt.

Edit: Drop what this answer provides and go with what @toscho wrote in his answer, which was correctly chosen as solution.