[wp-trac] [WordPress Trac] #64251: Documentation for `add_meta_boxes hook` is incorrect

WordPress Trac noreply at wordpress.org
Fri Nov 14 07:08:32 UTC 2025


#64251: Documentation for `add_meta_boxes hook` is incorrect
--------------------------------+------------------------------
 Reporter:  opr18               |       Owner:  (none)
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Options, Meta APIs  |     Version:
 Severity:  normal              |  Resolution:
 Keywords:                      |     Focuses:
--------------------------------+------------------------------

Comment (by soyebsalar01):

 The hook is too old and too widely used to be refactored without breaking
 plugins, so explicitly documenting:
 we can add the one line so User might not confuse.

 @param WP_Post | WP_Comment | stdClass $post

 do_action( 'edit_form_after_title', $post, $title ) this hooks used in
 several admin screens it is fired with non-WP_Post types, for example:

 Link editor -> passes a stdClass (legacy Link Manager structure)

 Comment editor-> passes a WP_Comment

 Some meta-box contexts -> might pass null or an incomplete object
 depending on screen

 so @opr18 is right  the docs expect $post to always be a WP_Post, which
 isn’t true. This creates fragile code, silent failures, type-hinting
 conflicts, confusion for people reading core docs.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64251#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list