Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5536

mihai2k on "wp_posts custom mysql column name"

$
0
0

Hi!
I don't to use wp_postsmeta but wp_posts. I have inserted a custom column name in MySQL table wp_posts , named "test_col".
I want to be able to use wp_insert_post to populate that custom column in mysql, like this :

// Create post object
$my_post = array(
  'post_title'    => 'My post',
  'post_content'  => 'This is my post.',
  'post_status'   => 'publish',
  'post_author'   => 1,
  'test_col' => 'whatever'
);

// Insert the post into the database

wp_insert_post( $my_post );

and also .. how can i gat that value out when get_posts()
Thank you !


Viewing all articles
Browse latest Browse all 5536

Trending Articles