Home wp_cronjob should run a special function
Reply: 0

wp_cronjob should run a special function

user1322 Published in May 24, 2018, 11:13 pm

I am creating a new wordpress plugins and I want to use the cronjob system from wordpress. But I get a little bit confused: Everytime the cronjob gets executed I want to run a special function. But the action will not be done. No post will be inserted.

The cronjob itselfs works correct. Maybe I do something wrong. (I manually tested the cron by opening the url wp-cron.php?immo_import_check_import_folders, and it shows me blank page. (Seems this is normal)


register_activation_hook(__FILE__, 'immo_import_activation');
register_deactivation_hook(__FILE__, 'immo_import_deactivation');

function immo_import_activation() {

    wp_schedule_event( time(), 'minutely', 'immo_import_check_import_folders' );
    add_action( 'immo_import_check_import_folders', 'immo_import_check_import_folders2' );

function immo_import_deactivation() {


function immo_import_check_import_folders2() {

    $my_post = array(
        'post_title'    => wp_strip_all_tags( 'Test' ),
        'post_content'  => 'test .......',
        'post_status'   => 'publish',
        'post_author'   => 1,
        'post_category' => array( 8,39 )
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.333604 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO