Support

Account

Home › Forums › Add-ons › Options Page › Custom meta box in options page › Reply To: Custom meta box in options page

  • I needed to add a custom metabox to an options page myself, but wasn’t satisfied by using output buffer (seems like a hack!)

    I dug through the option page source code and ended up with the following functions to:

    1. Create the (sub-)options page
    2. Register a metabox when on that page
    3. Display content within that metabox
    4. Save the values of that metabox

    It’s all very straightforward in the end. As far as I can tell, there is no hook equivalent to “add_meta_boxes” for ACF. And that hook does not fire on the options page, yet you still use add_meta_box to hook them in.

    Here is the code: https://gist.github.com/RadGH/a1473a24782e93435951ef0f390deb2e