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
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.