Question

I have asked here(Inserting a post in Wordpress using MySql) about how to insert a post in wordpress using mysql, but now I also need to insert some custom fields values, for example: if I have a custom_field called stack how can I insert a value for that custom field using mysql...

Was it helpful?

Solution

Ok I found this here: http://www.samburdge.co.uk/wordpress/wp-plugins-and-custom-fields

function add_custom_field($id) {
    //Add your value as a custom field with the key 'myKey'
    //but only if the form data exists
    add_post_meta($id, 'thumb_url', "value");
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top