It has been a few years since I have done any WP development but have a new project and want to create a plugin to keep the person who controls the site from having to do a specific process over and over again by hand.

My Plugin Concept:

The user will be able to upload images (icons) and associate the following information with each icon upload: Alt Id, Link URL, Caption Title and order of icons. The end result would be a shortcode that the admin can place anywhere and a "Google" style app navigation menu that will pop down on click. The navigation box will have the icons in the order defined. See the google apps menu in the header of google.com

My Question:

Should/Can I leverage any of the current image upload functionality already part of WP? In my workflow below is my use of a unique database for this app menu the best way to accomplish my goal?

My current workflow:

Admin Panel: The admin panel for the plugin will have a form the user can browse to an image, add the info mentioned above via form inputs and on submit the image is uploaded to the WP site and the entry is added to a database created for this plugin. The Admin page would update to show a list of all the current icons ordered by their "Order Number" with the option to delete the icon or edit the info.

Theme Integration: When a user adds a shortcode my plugin will query the database pull the icon data and loop through the query to building a fancy app menu.

I am not looking for anyone to write code but want to make sure my flow of data is correct and if I am leveraging WP's core functionality where possible.

  • When you upload the image it will be stored in wp_posts table, so you can add additional info in wp_postmeta table – Piyush Rawat Sep 27 '17 at 7:04
  • I am not looking at the DB now but would I have to create a new column in wp_postmeta to account for any data that it does not already collect? For example the order id set by the user at upload. – Denoteone Sep 27 '17 at 7:13
  • @Denoteone you dont have to add another column, insert new row for each meta field – Piyush Rawat Sep 27 '17 at 7:25
  • Thanks @PiyushRawat that makes sense. Sounds like everything I can do can be accomplished by using DB's and upload functionality already baked into WordPress. If you want to summarize your comments in an answer I will accept it. – Denoteone Sep 27 '17 at 7:34

Firstly you can upload the image using wp_media_handle as it returns attachment id.

Then try to add your desired metafields by passing the same id in each of them.

| improve this answer | |

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