Creating custom meta box throws PHP warning error in WordPress

Because the third parameter/argument in the add_meta_box function expects a callback function name, which in your case as you have supplied is homepage_meta_box_display. However you still haven’t defined that function yet.

The callback function is basically used to output the meta box content, anything that you would like to show up in the metabox you are creating. So you should supposedly be defining the function in a manner shown below:

function homepage_meta_box_display( $post, $metabox ) {

    echo 'Whatever goes here shows up in the metabox';
}

You can change it to whatever you want the metabox to display. Additional reference: https://developer.wordpress.org/reference/functions/add_meta_box/. And there is an example on that page too: https://developer.wordpress.org/reference/functions/add_meta_box/#div-comment-342.

tech