• I’m using the example here to use shortcodes to build multiple front end forms. However, only the 1st form I call from my plugin will post to the correct CPT. Everything else defaults to a standard post and draft status, even though I’m setting the attribute to post_status' => 'publish',. I even tried overriding the status and post_type in the short code.

    The form display fine on front end and saves, just as I said, not to its CPT.

    All of my functions are named differently, no apparent PHP errors.

    Any insight greatly appreciated.

    https://www.ads-software.com/plugins/cmb2/

Viewing 5 replies - 16 through 20 (of 20 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    The odd part about that line is that if you’re reaching that unset part, then the previous contents from $_POST['atts'] should now be in your $post_data variable, ready to be passed into the wp_insert_post() down on line 520

    Thread Starter Michael Bishop

    (@miklb)

    I truthfully can’t explain it unless cmb2_after_init is loading on every page load, thus the 1st call to it (paper in my case) blocks the subsequent attempts to set the attributes.

    All I know is I commented out those lines in all of my CPT & was able to create new posts on the front end with no *apparent* issues.

    This is a mu-plugin in a multi-site install (which I think I failed to mention) but wouldn’t think that would make a difference.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    If you’re satisfied with what you have now, I may carry on. If you still need me checking on anything, let me know.

    You did mention the mu part and I was emulating that part. The Multisite detail wasn’t mentioned previously though. I don’t think that’s going to play a part in it at all, since $_POST won’t care.

    Thread Starter Michael Bishop

    (@miklb)

    Yes, it is working for me. Didn’t know if you had any thoughts on why it might be firing on other pages, but I can mark this resolved. I’ll leave the gist out there in case someone else comes along with a similar problem.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Good enough for me. ?? thanks.

Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘Multiple Front End Forms’ is closed to new replies.