So i've followed the clearly documented pages for the packery and the draggabilly plugins to allow for a customizable grid and looked at how localStorage can be used to remember/store data of the re-arranged order of items upon reload.

So it works fine on the front end, closely following this example.

How would one go about saving this data to a wordpress database? Can one use localstorages data structure to put the updated post order into the db (so mainly a HTML5 and js solution)? Are there any wordpress functions that would aid with this customisation (possibly resulting in more of a PHP solution)?


You would have to do the following to save the order data into the WordPress DB,

  1. Do a WordPress AJAX sending the data that you want to be stored in it. You can do it at every re-arrange event of the elements.
  2. Handle the AJAX call in PHP and either do an update_option() or an update_user_meta() to save the data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.