nicks0r
Member
Posted 3 years ago #
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
fitztrev
Member
Posted 3 years ago #
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.
fitztrev
Member
Posted 3 years ago #
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()