Why is `add_meta_box` not working?

I can see 2 problems with your code. You seem to want that meta box to appear on product pages, but you actually add it to the post type and not the product post type. The other problem is the hook you attach your function to. Try this:

add_action( 'add_meta_boxes_{post_type}', 'abc_load_post' );

Substitute {post_type} with whatever post type you actually want to target, e.g. product, post or page. The fourth argument for add_meta_box() is the post type, btw, which you have set to ‘post’.

Leave a Comment