0

I am working on a plugin and I am creating a meta box on my page using the below code but it's not displaying anything.

Any idea where is the issue with my code?

class bt_dashboard
{

    function __construct()
    {

        add_meta_box('metaboxes-sidebox-1', 'Sidebox 1 Title', array($this, 'welcome_bt'), 'welcomebt', 'advanced', 'default');
    }

    function setup()
    {
        // setup class, maybe add hooks
    }


    function welcome_bt()
    { ?>
<h2>Wellcome to metabox</h2>
<?php }
}
3
  • Does your plugin page have a do_meta_boxes() call?
    – t31os
    Dec 5, 2022 at 20:39
  • @t31os, I haven't added that. Where should I add that? I am using only above code Dec 6, 2022 at 6:56
  • Inside a plugin page function attached to add_submenu_page or equivalent.
    – t31os
    Dec 6, 2022 at 15:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.