0

I'd like my script to post an article to Wordpress site automatically.

Looks like Wordpress's wp_insert_post() function is what I need. But if I would include wp-includes/post.php file into my script the function add_action() (placed in wp-includes/plugin.php) will be needed.

The same story to get_permalink() function.

So I will probably need to include more and more files and I don't really like it as I'm not sure that everything will be OK with this mass including.

Probably Wordpress has some let's say 'header' file?

I tried also to include wp-blog-header.php file which looks like including all needed functions (at least my script stops to argue for using of unknowing functions) but it sends headers and probably can do something what I'm not expected.

Disclaimer: I have read wp_insert_post page on Codex and make some network search. But I still don't have an answers.

1

You can include wp-load.php (in the root Wordpress directory). This will give you access to the Wordpress functions. Note that you can also load wp-blog-header.php, it loads wp-load.php eventually; wp-load will be lighter weight in the end.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.