简体   繁体   中英

Storing post meta data in wordpress

I just have a question regarding storing of meta data on wp_postmeta in wordpress.
I already understand how to store data on the table, by using add_post_meta() and to get the data by using get_post_meta().. Basically I store meta key by using underscore and a string. example "_this_varible". and I store meta value using any data from metabox.

My question are:
1.) Is there a problem if I do not store meta keys variable with underscore? for example _this_variable ?
2.) Is it ok if I store dates on the meta_key? I'm still confused on this part.
3.) I was thinking on storing multiple meta data on wp_postmeta with the same post_id. Is there's no problem with it?

  1. start meta key with a underscore if you want to use a custom meta box for the input of the value -- it wont appear in the custom field box
  2. you can store dates in the meta value....why would you want to make this a key? keys should be common to posts so you can pull reliably.
  3. as many as you want!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM