Support » Plugin: WP Crontrol » Any tips on using with WP All Import?

  • Resolved FreshySites

    (@freshysites)


    I’m trying to set up the Cron Job feature of WP All Import. My host directed me to use WP All Import… but I’m not seeing an easy way to add the URLs for the Trigger Script and the Execution Script.

    I’d like to run a few imports on a nightly basis … each at a specific time of the night.

    https://wordpress.org/plugins/wp-crontrol/

Viewing 15 replies - 1 through 15 (of 27 total)
  • I actually got this email from WP All Import’s support:

    <?php
    define('SCHEDULED_EVENT_NAME','your_import_name_exec');
    function your_name_wp_all_import_exec() {
    	wp_remote_get( 'INSERT WP ALL IMPORT TRIGGER OR EXEC URL HERE', array('timeout' => 600) )
    }
    add_action(your_import_name_exec,'your_name_wp_all_import_exec');
    ?>

    Of course, change the event name, the function name and the url in the wp_remote_get to your desired/required changes.

    manilLons

    (@manillons)

    Hi there,

    Please, can you give us an exemple ?

    The 2 WP all import CRON job are like this :

    CRON JOB 1
    Fetch this URL every 24 hours: http://YOUR-WEBSITE.com/wp-cron.php?import_key=%5BYOUR_SECRET_KEY%5D&import_id=%5BYOUR_IMPORT_ID%5D&action=trigger

    CRON JOB 2
    Fetch this URL every 2 minutes: http://YOUR-WEBSITE.com/wp-cron.php?import_key=%5BYOUR_SECRET_KEY%5D&import_id=%5BYOUR_IMPORT_ID%5D&action=processing

    Any idea to how to configure functions.php and your plugin with these informations ?

    Thank you !!

    Hi, using this plugin with WP All Import would be very useful for me too. Just a little more information on what the WP Crontrol action name and arguments should be and how they should relate to the PHP code would be useful.

    It looks like WP All Import needs two jobs, a trigger script and Execution script as mentioned above. On the Crontroller tools page you can either “Add Cron Event” or “Add PHP Cron Event”.

    What confuses me is that WP All Import seems to want to call a URL, but WP Crontrol seems to run a php script? So it’s not clear to me what the action name should be or how to link things up.

    In case it helps anyone, we created 2 separate crons to get WP Crontrol to work with WP All Import:

    1. PHP Cron, that runs every 2 minutes:
    wp_remote_get("http://yoururl.com/wp-cron.php?import_key=wD-qkI&import_id=3&action=processing");

    2. PHP Cron that runs every 24 hours:
    wp_remote_get("http://yoururl.com/wp-cron.php?import_key=wD-qkI&import_id=3&action=trigger");

    Thank you so much @freshysites
    That’s exactly what I was looking for! Thanks for coming back to share the code.

    Thank you @freshysites !

    I tried without good results. Using this code into my functions.php :

    if ( ! wp_next_scheduled( 'wpb_process_cron' ) ) {
      wp_schedule_event( time(), 'hourly', 'my_task_hook' );
    }
    
    add_action( 'wpb_process_cron', 'wpb_process_cron_func' );
    
    function wpb_process_cron_func() {
      wp_remote_get("http://yoururl.com/wp-cron.php?import_key=wD-qkI&import_id=3&action=processing");
    }
    if ( ! wp_next_scheduled( 'wpb_trigger_cron' ) ) {
      wp_schedule_event( time(), 'hourly', 'my_task_hook' );
    }
    
    add_action( 'wpb_trigger_cron', 'wpb_trigger_cron_func' );
    
    function wpb_trigger_cron_func() {
      wp_remote_get("http://yoururl.com/wp-cron.php?import_key=wD-qkI&import_id=3&action=processing");
    }

    With my own wp all import cron setting off course.
    Then adding new cron “wpb_trigger_cron” and “wpb_process_cron” with your plugin.

    Can you help again ?

    Best regards

    I wish the plugin developer would chime in here. But one thing I did notice in your pasted trigger example has

    &action=processing

    but should be

    &action=trigger

    Not sure if that was a typo when you wrote your comment or not though. I really don’t know much else beyond what I already previously posted. 🙁

    Bad copy paste, but you are right, it should have been &action=trigger here.
    I will investigate a bit more, then come back here if I have any good results.
    Thank you again.

    can someone provide how to get this to work? I have multiple crons to run with WP All Import and WP All Export. I cant get them to run. I moved my hosting to a wordpress optimized hosting but they do not give ssh access and no cpanel…

    • This reply was modified 2 years, 6 months ago by ryanb4614.

    @ryanb4614 What’s up? Is your hosting happen to be WPEngine?

    I am using Host Gator wordpress optimized. They give a very simplistic email and don’t allow you to access the cpanel & no ssh.

    Ah ok, so here’s what you do. Double check the wp-config.php and make sure DISABLE_WP_CRON is set to false. It’ll look like the line below:
    define('DISABLE_WP_CRON', 'true');

    This will make sure that the wp-cron.php runs. If that line doesn’t exist at all, create a line define('DISABLE_WP_CRON', 'false');.

    • This reply was modified 2 years, 6 months ago by lljb3.

    Yes that is. But with WP All Import its not showing that the cron is running or ran. So it must be how I am setting up the cron then?

    You can use the EasyCron plugin with WP All Import. However, EasyCron is a paid service for high volume and you need to disable the default wp-cron.
    You can copy and paste the Execution and Trigger URLs and set the schedule however you need it.
    REFERENCE to code change recommendation above:
    wp-config.php
    make sure DISABLE_WP_CRON is set to true. It’ll look like the line below:
    define( ‘DISABLE_WP_CRON’, true )

    Hello guys

    Did anyone get this to work actuallly?

    I’m using WP Crontrol with WP All Import as well but none of the above options did the trick for me so far. Tried the freshysites but there seems to be code missing (php?).

    And it is not clear to me if I should or shouldn’t do anything in my functions.php

    Can anybody enlighten me what to do exactly to get WP All Import to work via WP Crontrol?

    Thanks a million!
    Olaf

Viewing 15 replies - 1 through 15 (of 27 total)
  • The topic ‘Any tips on using with WP All Import?’ is closed to new replies.