add_meta_boxes WordPress Action Hook

The add_meta_boxes hook allows you to add custom fields to the post editor screen. This can be used to add extra data to posts, or to create custom fields for specific posts.

do_action( 'add_meta_boxes', string $post_type, WP_Post $post ) #

Fires after all built-in meta boxes have been added.


Parameters

$post_type

(string)Post type.

$post

(WP_Post)Post object.


Top ↑

More Information

The hook allows meta box registration for any post type.

Passes two parameters: $post_type and $post.

Note: You can also use add_meta_boxes_{post_type} for best practice, so your hook will only run when editing a specific post type. This will only receive 1 parameter – $post.


Top ↑

Source

File: wp-admin/includes/meta-boxes.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
3.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.