Loading WordPress Admin Environment

I am using the following library to create custom posts:

It works perfectly, however I wanted to use it as stand alone custom_post.php file to run through CRON job to automatically create new posts. To achieve this I have add the following line to my main custom_post.php file:

if ( ! defined(‘ABSPATH’) ) {
/** Set up WordPress environment */
require_once( dirname( __FILE__ ) . ‘/wp-load.php’ );

When I run this file through browser it works perfectly and adds a new post with custom Title, selects Category, adds new thumbnail and sets desired author.

Then I setup the CRON job, which creates new post, sets thumbnail, selects category, adds desired author BUT the post CONTENT is empty. Then I figured out it only adds the post CONTENT when I am logged in to Admin in any of the browser.

How can either I login or load admin environment to make this happen and it adds the post CONTENT. Secondly, is there any restriction while adding post_content ONLY for admins or allowed users ?..

Read more here:: Loading WordPress Admin Environment

Leave a Reply

Your email address will not be published. Required fields are marked *