Hey
I successfully created an option page with a few sub-pages with ACF (using acf_add_options_page() and acf_add_options_sub_page()).
Independent to that I created two custom post types for letting people add and create custom content for their projects. WordPress added its own option pages for that, as indented.
My question now is: How can I push the custom post types as a sub-page to the ACF options framework I built? I want to merge them so they don’t take up that much space.
Thank you,
Jakob
For a detailed example of how to make a CPT a sub page of an ACF options page take a look at this https://github.com/Hube2/acf-filters-and-functions/blob/master/acf-options-page-w-cpt-children.php
Awesome John, this example pointed me into the right direction.
Strangely and after experimenting with the long code this example uses, I was able to just add the first ACF sub page as a ‘show_in_menu’ value to the CPT, and it worked without anything else. Why this works – I don’t really know.
Thanks a lot!
I’ll need to look into the ACF code, it’s been a while since I did that, maybe ACF is not registering the options pages earlier, either that or WP has changed. There are so many variables to keep up with…..
I’ve looked at all the relevant code in ACF and it’s still the same. I don’t know why it’s working for you without the extra work, but please be sure that you let me know if it keeps working. The note is still on the WP Codex about the priority needing to be less than 9 for it to work… and to be honest, I dug through WP when I was trying to figure out why it would not work for me and could find no reason for it, the code was just too convoluted to follow. So either something has changed in WP or you are seeing a behavior that you should not be seeing.
Thats strange. Did you also got it working what my solution was?
I have not tried. I have the solution I posted on github in place on a couple of sites and right now there’s no reason to go back and change those. I don’t really have a place I need to do this right now, so until I do I probably won’t be testing it again. But the next time I need to do something similar I will see if it’s working that way now.
The topic ‘Options page: Add custom post type as child’ is closed to new replies.
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.