1

I am using the following library to create custom posts: https://github.com/HarriBellThomas/Wordpress_PostController

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 ?..

1
  • You should use WP CLI instead
    – Tom J Nowell
    Commented Jul 1, 2021 at 9:47

1 Answer 1

1

The problem was that iFrame was being stripped, I tried all methods to allow iFrame code butdidn't work, so I wrote a simple short-code and now it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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