Can I add my own meta box inside an existing options page? I have tried but I’m struggling to get anywhere..
The problem you’re running into is the fact that when ACF creates the options page it sets the function for outputting it’s metaboxes to the field when calling add_menu_page() or add_submenu_page(). In order to customize an options page you need to figure out the hook that is used by WP to run that function and then alter the content that is output by ACF. I have a simple example of modifying the content of top level options page here https://github.com/Hube2/acf-filters-and-functions/blob/master/customized-options-page.php
Thanks for the quick response. What I’ve done as a temporary fix is bind onto the
acf/render_field action and targeted a message input type inside an ACF meta box… seems to do the job quite nicely 🙂
Great plugin all in all, we wouldn’t be anywhere without it! It’s the only plugin we always use.
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