Forum Replies Created
-
AuthorPosts
-
arranfraserMemberThanks @Steve, but I’m not sure we’re understanding each other yet. That’s fine — and I’m happy to help with future re-testing around these issues if that can be helpful.
But… I’m trying to use an add_more to create-and-relate CPT2’s on the edit form of CPT1. I’m not trying to use an add_more to create-and-relate CPT2, CPT3, etc.
And… the add_more field to create-and-relate CPT2 actually does work, just only the first add_more.
And more easily reproducible… the demo code that looks like it should create-and-relate vanilla Posts to Piklist Demo Posts, also doesn’t work beyond the first add_more.
arranfraserMemberFair enough!
Would you say the best work-around is the post-relate field type? User just has to add new posts first before they can be chosen to relate to another post, right?
arranfraserMemberHi again Steve,
This might be relevant info 😉
I just tried this same test on the Demo. So… New Piklist Demo > Relate > Advanced. I can add ONE New Post, but not TWO.
Is there something up with my installation somehow? Does that feature work for you?
arranfraserMemberYes, that’s exactly what I’ve tried.
I’ve now reproduced this issue again on a simpler project. Again – the first post is saved perfectly, but when using the “add more” feature, the second post doesn’t get saved at all.
This field is in a meta box on custom_post_type_1:
piklist('field', [ 'type' => 'group', 'scope' => 'post', 'label' => 'Add Staff', 'relate' => ['scope' => 'post'], 'add_more' => true, 'fields' => [ ['type' => 'hidden', 'field' => 'post_type', 'value' => 'custom_post_type_2', 'scope' => 'post'], ['type' => 'hidden', 'field' => 'post_status', 'value' => 'publish'], [ 'type' => 'text', 'scope' => 'post', 'field' => 'post_title', 'label' => 'Name', 'columns' => 6 ] ] ]);If I add an instance of custom_post_type_2 using this form, the data is saved and the new post is related properly. (Interestingly, this data is also preloaded when I refresh this form after saving.)
If I add a second instance of custom_post_type_2, nothing is saved at all to the database when I submit the form.
arranfraserMemberNo, it’s only needing to add one post_type (student).
The only difference from the demo, is you’re relating vanilla post (and User and Comment) back to the demo post type. I’m trying to relate other custom post type back to my custom post type.
Possible? Thanks for looking at this!
arranfraserMemberOK, I found this in the Demo:
add_filter('piklist_post_submit_meta_box', 'piklist_demo_post_submit_meta_box', 10, 3);I’m not sure if there’s any documentation on that hook? – but it seems to accommodate what I’ll need 🙂
-
AuthorPosts