I see how you are saving meta box data for the wc_pte_enable meta box. I don’t see any fields or code to save fields for wc_pte_files meta box. You posted a lot of code, I may have missed something. This appears to be why you are not saving data.
To do anything from a meta box, such as creating another post, you need to hook into an action that fires when the form containing the meta box is submitted, such as “save_post” action. Just like you can save meta data in such a callback, you can create posts. The one thing to watch out for is it is not guaranteed that any action will only fire once per request. When updating data, there is little downside if the same thing is saved 2 or 3 times. Not so if creating posts. You need to take measures to ensure your callback only inserts a post the first time through, not every time. Also, creating posts from the “save_post” action will result in an infinite loop unless measures are taken. One way to do this is have your callback remove itself from the action stack before adding the post. (use remove_action())
Next time you need to post a large amount of code, please use Pastebin or make a Gist, they make code much easier to read. Especially if you enable syntax highlighting. Do ```php
in Gist, pick the language when saving in pastebin. Posting large amounts of code is against our Forum Guidelines.
Thank you for your response. This morning, I created a simplified version of what I am trying to do. Here’s the Pastebin link: https://pastebin.com/Cr0U8cbC.
I am working with the suggestions you provided and will update this post with the results.
Thanks!
]]>