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 $object
would 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
- Embed dynamic php snippets with parameters in a blogpost
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- How to call plugin function per site in a multisite?
- Print last modified date only on posts
- different id for same element visual composer [closed]
- WooCommerce: How can I get orders with a custom ID in order meta data object?
- Tax query in pre_get_posts not working
- WordPress Gravatar filter is removing my custom attributes
- foreach loop still echoes array
- trigger html cleanup for all posts
- Error in custom php function doesn’t exist
- dynamic dependent select dropdown
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- Custom shortcode outputs plain text instead of HTML at top of post
- how can i use $_COOKIE[] + PostID to execute the below code?
- Return a numerical function value in Customizer controls
- getting logged in user info (wp-load.php) from parent directory
- How can I get the values of my WordPress $wpdb query in Jquery?
- What’s the uses of wp_cache_set() or wp_cache_add()?
- Get users that likes the post
- Blog posts repeat
- Ajax load more button for comments wordpress
- Function to capture a value and store it in a variable
- How to abort saving data in save_extra_profile_fields function WordPress?
- Pass php dynamic variable to shortcode
- Unique icons next to each WordPress menu item
- 3 Slashes appear after Apostrophe in custom fields after updating product-site
- How to create a php variable using WordPress the_title() function
- Keyword checking in Gravity Forms
- how to refresh div on template part?
- Child page menu in sidebar
- How to modify a global variable in a function and use it on another function?
- Populate editor with some content of a page with a page template
- Title Case WordPress Menu Items
- I want to load in a new class but only if the current page is single-movies.php
- Customizer: Category Select Sanitize
- Modify function to print tags/categories/exclude tags/categories/ number of posts
- Incorrect amount of posts returned when filtering related Woo products by custom taxonomy
- Search not showing all results
- Validation algorithm in checkout field
- Css loads very slow [closed]
- Catchable fatal error: Object of class stdClass could not be converted to string after WP 4.7
- Settings API callback function inserts html quotes from nowhere
- Show when user is online/offline in real time on user_profile.php
- Limit 1 global comment per minute
- Create highly customized submenu (possibly using wp_list_pages)
- Create Page To Count Comments For Each Post In WordPress Site
- Modify custom field input data before creating a new post
- Adding a widget function into the php theme file
- Update user profile information from functions.php
- WordPress Quick Question . How to Get Parent Link in Submenu in My Code
- Get the date of the className or classID
- My new button is in the wrong place
- Can’t find infinite loop cause
- how to make custom ajax handler?
- Checking array against author id in loop
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- Scrape external webpage for first image and add it to new post
- Skt full width basic slideshow problem
- How to Reference/Echo Variable from Another PHP Function
- Remove echo from shortcode
- wp-comments-post.php file returns a blank page
- php function to display commenter username or login
- Detecting classes, adding widgets, and adding divs in with a Nav Walker
- Add .htm extention to a custom taxonomy
- theme_root returning a truncated URI
- $wpdb->wp_users returning empty value for
- WordPress Custom field Colors
- How to change menu order item
- Call to undefined method – Download Monitor
- Query Pages and post excerpts dynamically
- How to disable controls in theme customizer?
- Way to add captions to gallery images by code
- How do I link a button I created in theme customizer to a function?
- Trying to retrieve post meta
- Need help enqueueing webfonts
- register_taxonomy() take much queries
- Can anyone offer any help with this function?
- php syntax : [ && ] between commands [closed]
- Add class to group inner container
- Call to undefined function get_userdata() in plugin
- Custom gallery in wp3.5
- Echo string and function?
- responsive.css in the WordPress should be prioritized