Support Forum
I'm moving to Meta Box from Pods and one thing I'm curious about...
In Pods, if I have a custom field that is selecting from a different collection, there is an option to add a new record on the related collection.
Is this currently possible with Meta Box?
Here are some screenshots from Pods:
When adding a custom field in Pods, I can choose to allow new records to be created on the related post type. For example, on my custom post type of Projects, I added a custom field called Project Manager, which allows me to select an entry from the custom post type called Project Manager.
Then when adding/editing a Project, if the Project Manager is not already in the Project Managers collection, this button opens a modal to add a new Manager right away so that it can be related to the Project I'm currently editing (without having to actually leave the Project edit screen)
Sorry if this is too confusing. I can try to explain better if needed.
If this is not already available in Meta Box, If you could at least point me in the right direction for where I would begin adding a feature like this myself, that would help too! Thanks!
I just came to the forums looking for this as well. I'd love this feature too.
I'm still working on this. Currently, it's the only thing that prevents me from using Meta Box for every project.
I made a REALLY messy plugin here that satisfies what I need for a current project:
https://github.com/brandonjp/add-add-new-to-meta-box-select-advanced
If you have a Select Advanced field used for selecting a related post, this will add an "Add New" button that opens a modal. There are a few options inside the JS file.
Hopefully, it might help others toward their own solutions. If you have questions, let me know.
Hi Brandon, thanks a lot for your code!
Just FYI, I added the "Add New" feature for taxonomy/taxonomy advanced. But it's limited to enter only the term name in a text box, not a window for full details like in Pods. I'll investigating in your code and hopefully can bring it to Meta Box soon.
Thanks, Anh.
Also, I just added a few config notes to the README to answer a few questions that someone else asked: https://github.com/brandonjp/add-add-new-to-meta-box-select-advanced#for-developers
A couple quick notes: After adding a new post in the modal, the user must search again in the Select Advanced to trigger a new query and find their newly created post. And Ideally, I'd open the modal without WP Admin toolbar by setting IFRAME_REQUEST
(as shown here: http://rizqy.me/create-modal-box-on-wordpress-dashboard/ ), but I'm not quick enough to whip that up yet.
Again... It's very quick & messy code 🙂 But feel free to ask if anything doesn't make sense.