Post Meta Fields for Post

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.

Programmer Section

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s