Support » Plugins » Database tables – post to category relationships

  • I am planning to manually insert a post outside of the wordpress front end into the ‘wp_posts’ table

    To have this post match up with a category I only have to make an entry in the ‘wp_term_relationships’ table (assuming my category already has and ‘term_taxonomy_id’ established.

    Does this sound accurate or am I missing anything here?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The easiest way is to call the wp_insert_post() function.

    Do a ‘require’ of wp-blog-header.php in your script and you’ll be able to call it. You pass wp_insert_post() an array that contains all the post info and the categories/tags and it will take care of the rest.

    P.S. There are also these 2 functions which may be helpful, although wp_insert_post already incorporates them:

    wp_set_post_categories()
    wp_set_post_tags()

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Database tables – post to category relationships’ is closed to new replies.