• I understand that wp_insert_post inserts things into the wp_posts table.

    If i make a custom column in that database and put it in the wp_insert_post array, will it be inserted?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter tehjrow

    (@tehjrow)

    Never mind, found this.

    The user can provide more elements than are listed here by simply defining new keys in the database. The keys should match the names of the columns in the wp_posts table in the database.

    Thread Starter tehjrow

    (@tehjrow)

    Ok it’s not working.

    I made a new column in wp_posts called post_location.

    $my_post = array(
           		'post_title' => $_POST['Title'],
           		'post_content' => $_POST['Message'],
    		'post_status' => $my_post_type,
           		'post_author' => $user_id,
           		'post_category' => $category,
           	        'comment_status' => (($enableComments && !$use_anonComment)  ? 'open' : 'closed'),
           		'ping_status' => 'closed',
    		'post_location' => 'isitposting'
           	);

    When i use this array with wp_insert_post it inserts everything in the array except post_location. Why?

    Thread Starter tehjrow

    (@tehjrow)

    Ok yeah, i’ve been messing with it and I can’t figure it out. Is there any way I can echo out the SQL that is being ran?

    Thread Starter tehjrow

    (@tehjrow)

    So i’m just going to use add_post_meta, it works.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘wp_insert_post with custom columns?’ is closed to new replies.