add_meta_box not saving fields for more than 10 minutes (2 posts)

  1. toomanyairmiles
    Posted 4 years ago #

    I've created the following add_meta_box and associated fields but the problem I'm having is that the content of the meta box fields disappears after about 10 minutes. I've tried vairious solutions online but none seem to work. Any help or tips apprecated.

    I've also been told elsewhere not to use admin_init however renaming the function causes the meta box to disappear from inside the CMS, any futher advice on this would be greatly appreciated.

    [Code moderated as per the Forum Rules. Please use the pastebin]

  2. NateJacobs
    Posted 4 years ago #

    Please limit your code in the post to 10 lines or less. If you need more use pastebin.com. I created a pastebin for you, http://pastebin.com/ZmT2iw1x

    On to your code.

    WordPress 3.0+ provides an action called add_meta_boxes so you don't use admin-init to add meta boxes. There is also an action called 'save_post' that you can hook into to save your meta boxes along with the contents of the post.

Topic Closed

This topic has been closed to new replies.

About this Topic