How to manually create posts with wp_insert_post function?
-
I want to manually create posts directly inserting all fields (title, content, etc.) to database. I have read that a function wp_insert_post can do basically all the stuff and you only need to have title, content and category values.
So if I have my variables: $posttitle and $postcontent how do I construct php file to insert those values and create a new post not from admin panel but by loading this php file?
let’s say I have:
`<?php
$posttitle = “Title”;
$postcontent = “Content”;?>`
What to add into it so that when I run the file it will insert new post into wordpress?
The topic ‘How to manually create posts with wp_insert_post function?’ is closed to new replies.