How to Include init.php (preferably on the ‘init’ WordPress hook)

Hi I’m trying to add some code to allow custom meta boxes on my wordpress site:

github: https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress

Read More

It states that I need to include the supplied init.php on the init wordpress hook, but I’m just wondering how to go about this?

Thank you!

Related posts

Leave a Reply

1 comment

  1. add_action('init', 'include_init_file');
    function include_init_file() {
        // use correct path here
        require_once get_stylesheet_directory() . '/metabox/init.php';
    }
    

    the above code goes in theme’s functions.php file. You have to correct the path to init.php file. The example above assumes the path as [theme_directory]/metabox/init.php