Skip to content

Instantly share code, notes, and snippets.

@wpscholar
Last active November 30, 2016 13:39
Show Gist options
  • Save wpscholar/fc2e3bfc303f7da9dd0c to your computer and use it in GitHub Desktop.
Save wpscholar/fc2e3bfc303f7da9dd0c to your computer and use it in GitHub Desktop.
$wpdb->insert() example
<?php
global $wpdb;
$wpdb->insert(
$wpdb->postmeta,
array(
'post_id' => get_the_ID(),
'meta_key' => 'name',
'meta_value' => 'John'
),
array( '%d', '%s', '%s' )
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment