Custom meta box functions are allowed for design only. Ensure this is a valid use case

Hi.

I got a soft reject recently and I am in big trouble, I use cosutom metaboxes for pages and other section of the theme and this metaboxed basically have the page builder for the theme, is a custom page builder.

When checking with the theme check plugin I get this warninig.

Found add_meta_boxes in the file about-us.php . Custom meta box functions are allowed for design only. Ensure this is a valid use case.

Dose this mean that I am nota allwed to do this?

Thank you.

Is about-us.php some sort of custom page template file? Because stuff like metabox definitions have no place in a template file regardless the context. I am talking about the general good code practices. You should separate your functions, actions and the frontend output, otherwise you are just creating a mess of a code.

add_meta_boxes action itself can be in a theme, if those metaboxes are used for design (I mean that messages literally tells you that), but you should place it in a functions.php or some other file where you are placing your actions. Not in a page template file.

Thank you for your response.

Yes about-us.php is a custom page template.

SInce this year I am not sure the date, all metaboxes if used have to be added in a plugin a long with a bunch of other stuff, I wish I would have read this when I started working on it, I am working on it now :slight_smile:

I’d just say that “allowed for design” is at a discretion of your reviewer. So, if reviewer noted this, then yes, but if it was the theme checker plugin, maybe you can skip this one for now, and ask a question as a note on your next re-upload. So, if this raises more issues you’ll be noted directly. I think that metaboxes will eventually be reserved only for plugins.

Thank you for your reply.

I already move this in a plugin a long with theme settings and other requires stuff, I just go a green light with theme checker plugin, thank god.