In WordPress, whenever we add our posts into website, sometimes we need to add an extra information along with post in various parts. For instance, A post can contain Selectable fields, input text fields and so on.
To add such kind of information with post we have an amazing solution provided by WordPress.
To add extra information with post we can use add_post_meta() function. This function contains post id , post meta key, ( post meta key should unique for each time) and array or no array content .
We can get post id just after it created. So the use of Ajax it makes more reliable for programmers.
Get post meta
We can retrieve saved post meta fields by as same as we previously added. Its little bit similar to save post meta function. We can use get_post _meta() function to retrieve our post meta by using post id. Its very important to mention post meta key along with post id in this function to retrieve our information