Skip to content

Incorrect variable type used with add_meta_boxes hook (second arg is WP_Post, not ID) #185

@omaraelhawary

Description

@omaraelhawary

Description

The callback hooked to add_meta_boxes treats the second parameter as a post ID instead of a WP_Post object. On PHP 8+, this can surface TypeErrors and prevent meta boxes from registering/rendering reliably.

Steps to Reproduce

Activate Members plugin

Expected Behavior

No type errors; meta boxes register and render normally.

Actual Behavior

PHP Fatal error: Uncaught TypeError: callback argument #2 ($post) must be of type WP_Post, int given

Hosting Environment

No response

Payment Gateway (if applicable)

None

Transaction ID (if applicable)

No response

API, Server, or Error Logs (if applicable)

Screenshots or Videos

No response

Support Ticket Link

https://wordpress.org/support/topic/incorrect-variable-type-used-with-add_meta_boxes-hook/

Additional Information

No response

Site Health Check Report

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions