How to Add Custom Fields Automatically on Post Publish in WordPress

First thing you need to do is open your theme’s functions.php file and paste the following code:

Tables can't be imported directly. Please insert an image of your table which can be found here.

1 2 3 4 5 6 7 8

Then simply replace the field-name and custom value with your Custom Field Name, and the Value. This is a relatively simple trick, but it can be very effective when trying to use WordPress for other than blog purposes.