If you have a look at function do_meta_boxes() in wp-admin/includes/template.php then you’ll see this line close to the end of the function:
call_user_func($box['callback'], $object, $box);
That calls the callback function and provides the two arguments. The $box argument holds all the information about the metabox, like ID, title, callback function.
In wp-admin/edit-form-advanced.php, which displays your post edit/create screen, you can see the do_meta_boxes calls in action, e.g.:
do_meta_boxes(null, 'advanced', $post);
So, in that case $objectwould indeed be a post object. In other cases, like the dashboard screen, $object is actually set to an empty string.
It might be worth noting that add_meta_box() just adds to the $wp_meta_boxes global. In do_meta_boxes() that global then gets looped through and the boxes are being displayed.
Related Posts:
- How to set and use global variables? Or why not to use them at all
- How to call a function only once (global variable scope)
- Create a global variable for use in all templates
- How do I know what variables are passed in a filter/action and what their meaning is?
- How can one utilize a variable as a callback function name for add_settings_field
- Get value from shortcode to do something
- Warning: call_user_func() expects parameter 1 to be a valid callback, function
- Custom global variable not working in function
- Hide payment method based on user role AND minimum cart value
- Show data obtained from a function and place it in a shortocode function
- How Can I Display the Last Modified Date for User Profiles on WordPress?
- What is the proper way to call a function (from functions.php) on a link click?
- Calling PHP function doesn’t work in index.php
- Shortcode to include PHP file, pass various parameters to include?
- Suppress errors when using global function
- Create and publish a new post every Monday, listing the post titles and links to the posts published during the previous week
- Allowed memory size of 268435456 bytes exhausted (tried to allocate 7146491840906359738 bytes)
- Customize default settings on new sites on multisite
- How do I get the author’s page url from their ID?
- Remove class that has been added by parent theme
- How to check from which page the user is coming to the current page?
- Setting up the child theme so as to enable right-to-left WordPress?
- Design view breaking on Pages
- Hooking new functions to actions + passing parameters
- Execute only on a certain page
- Replace comment avatars and links at the same time
- Check if Product is in a Specific Category in Functions.php
- Adding ads code between comments
- Create Logout Link WordPress Admin Menu
- How to Display Image Meta underneath EVERY image in EVERY post
- Limiting woocommerce line_total decimal length
- Shortcode content filter?
- only show container with next/prev links if they exist?
- JS file work only in index page
- Error in custom php function doesn’t exist
- Custom shortcode outputs plain text instead of HTML at top of post
- how can i use $_COOKIE[] + PostID to execute the below code?
- Custom gallery in wp3.5
- Noscript not working as it should in wordpress site
- How to use theme function in post/page?
- esc_url( ) won’t use https
- Content filter won’t work
- calling a custom field value inside functions.php
- Custom meta box values are not getting saved for my custom post type
- Simple AJAX notification when the new post is added to the database
- Upload multiple files in randomly generated folder using wp_upload_bits
- Personalize checkout text
- WordPress check if current taxonomy has child
- get post id from wp_insert_post for get_template_part
- This function is deprecated; use mysql_real_escape_string() instead
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- Adding an interior ‘hero’ area with some added php title customization
- ‘global’ not working in wordpress?
- Custom Taxonomy Select Menu: Setting default option value?
- How to add author’s posts link (HTML + PHP) inside a function to output it
- Creating customized php files in theme folder
- Conditional On custom field plugin metabox
- Post Views Code Hacks
- Closing WP_LINK_PAGES DIV ID w/After Argmuent
- Exclude function from running on a certain page
- How to set value selected using select2 jquery plugin
- Workaround for og:image unsupported webp image type, Yoast SEO?
- Disclaimer that will show every refresh of the page
- Using ACF Relationship field to set post type to draft or published status
- Providin exception to WordPress wp_nav_menu Custom CSS Classes
- Woocommerce My acount page
- How can i avoid duplicate same post in wp?
- Child theme overirde template-tags in a theme built on underscores in inc/template-tags
- Custom meta box is not displaying value showing tag as empty
- Menu not updating for logged in users after redirect
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- All categories options or All categories not Populating
- WordPress load javascript file if something… (after the page is loaded)
- Add class for the_post_thumbnail_caption()
- Getting page / post URL on publish and / or update
- Wrapping shortcode content in a span or link
- Weird Behaviour: Not all WordPress Posts appearing
- Save the outputted image into the Media Library, with a different filename and extension
- Permission functions within wordpress
- Adding ID to a Listing but not inside WP_Query while
- adsense code showing on random post thumb
- key( $GLOBALS[‘wp_registered_sidebars’] ) is always showing the same value
- WordPress display name string manipulation
- How to extend the page editor?
- which table updated after logout?
- Accessing WordPress Functions get_permalink() in Vanilla PHP?
- How to return a Boolean for a page that is a subpage thru its name?
- I need a button to appear when not loged in and another when logged in, I need help fixing code PLEASE!
- Saving User Input to PHP Variable
- Undefined variable notice [closed]
- How to hide .js files on wordpress website using php or wp plugins or any? [closed]
- get second ID from array
- How do I get a function to work in single.php
- Using global variables
- WordPress different custom tag being displayed in on tag list
- How can one use variables in a template or template part without polluting the global scope?
- How to access admin menu labels and links on front-end?
- If you want to implement custom field-wise search functionality in the WordPress admin area
- How can we upload custom page files?
- How to get default variation ID (woocommerce)