What Is meta_id In wp_postmeta?


I am trying to add some data in WordPress Custom Field and via adding more direct records/data in wp_postmeta table via SQL query. There are four column as mentioned below…

  • ‘meta_id’ – A unique id for each entry.
  • ‘post_id’ – The ID of the post for this metadata.
  • ‘meta_key’ – The name of the ‘key’.
  • ‘meta_value’ – The value associated with the key.

Now I am using the below SQL query to add some more records/data.

$INSERTING_DATA = "INSERT INTO `wp_postmeta` (`meta_id`, `post_id`, `meta_key`, `meta_value`) values ('XXXXXXXXX', 'WordPress_Post_ID_No', 'WordPress_Post_Custom_Field_Name', 'WordPress_Post_Custom_Field_Value')";

So here I am able to add all my data but I want to know that what to add in meta_id column ? Is that auto increment value so I have to leave that value and should I use below SQL query…???

$INSERTING_DATA = "INSERT INTO `wp_postmeta` (`post_id`, `meta_key`, `meta_value`) values ('WordPress_Post_ID_No', 'WordPress_Post_Custom_Field_Name', 'WordPress_Post_Custom_Field_Value')";

So Now tell me which one is correct and Ok to use. First or second…??? Also describe me that what is meta_id in this table?

Muhammad Hassan 1 month 0 Answers 9 views 0

Leave an answer