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
- Displaying Logged-In User Name in WordPress Menu
- Set media upload attachment link to none and hide it in WP v3.5
- Fatal error: Call to undefined function plugin_dir_path()
- Switching wp_get_sites to get_sites
- One button to change all settings in theme customizer?
- Add custom image sizes to media uploader
- How to add default images into theme customizer image control?
- Is $hook a global variable in WordPress
- Successful or Error Message after running mysql code in functions.php
- Custom Logo URL | Help me print the URL of the custom logo I inserted into my theme
- Include a php file from functions.php only to homepage
- Shortcode content output but not in correct place
- How to restrict page access to logged-in users?
- Count the number of times the search form template gets included on a page
- Handling Body class based on Template
- Adding Default Settings to Theme My Login plugin
- Automatically adding new post categories to menu
- Get post id in a function when edit/add a post
- function to assign user role based on a field from usermeta
- get author_name from queried post
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- WordPress Gravatar filter is removing my custom attributes
- Incorrect amount of posts returned when filtering related Woo products by custom taxonomy
- Remove echo from shortcode
- Copyright info change – Corporate Plus Theme PHP [closed]
- Inject class in body when particular page template is used
- How to list posts from a plugin taxonomy?
- Filtering a function’ output for a new continued function
- Shortcode to find and replace URL
- Deleting Certain terms from appearing on the front end as links
- first instantiated SimplePie object cosumes 5mb?
- Theme not calling Jquery properly
- Adding a tag_ID column into Categories inside the admin dashboard?
- Need php code’s output to display underneath a Divi Module
- WP_Query | IF within $args array | Help me only add specific arguments if the argument is not blank
- How to make function appear in sentence?
- How to define a variable already defined in a plugin function?
- woocommerce specific quantities for product
- My website is not showing Footer section
- woocommerce related product title length
- Custom query vars filters problem with pagination
- Query for user roles
- Use SCSSPHP to compile Theme Customizer Values into .SCSS files ready to compile to CSS
- Must filter functions receive all arguments passed to them?
- How to Display a List of Child Pages For a Parent Page in WordPress
- Php file that doesn’t recognize wordpress functions
- Displaying Slider in Front Page (home) using Customizr Theme
- How to add PHP pagination to wordpress
- Is there a way to create a “copy post” link?
- Taxonomy term description with style, only if the description exists?
- Use of antispambot with $curauth->email
- Restrict post to current user in postmeta
- How to change the author box selection on a post to a custom taxonomy
- How to send a php var to jQuery Ajax call with two different file
- copy fields value to another field
- not outputting medium size image URL
- posts_per_page displays only 2 posts instead of 4 posts
- Get parent category name when only child category is applied to a product
- Can an AJAX callback function access a PHP variable which was defined during initial page load?
- Adding product permalink on admin order page throwing error
- Before & After Content – After Content directly below Before Content when using require_once
- How to redirect (301) trashed post to it’s parent taxonomy TERM ARCHIVE instead of 404 page
- How to call WordPress PHP file using external js file
- How fix error in the WordPress loop?
- Loop 1 user randomly
- use system script advertising in wordpress multisite
- Use WP_Query Data In Cookie
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- Styling admin page rows in order of importance (checkboxes)
- Insert wordpress tags below posts via functions.php
- Help with my first Metabox helper class
- WordPress $GLOBALS and PHP $GLOBALS
- ISOTOPE – Missing/Invalid Arguement Get Terms
- Showing all post from all post type in admin backstage
- Pagination not displaying
- My title is showing after the shortcode
- Load a Header in wordpress
- Trouble figuring out how to get my button to submit comment
- Setting WooCommerce currency programmatically
- Masking external links with internal link for member-only
- Adding multiple conditional tags in a function?
- Understanding responsive imagery
- How to get meta box labels?
- Tags being Inserted in html from plugin PHP not passing through the_content