WordPress Cron how to find out my event recurrence?
I think I’ve found it: wp_get_schedule(‘myhookname’) Edit: yes this works as I want it.
I think I’ve found it: wp_get_schedule(‘myhookname’) Edit: yes this works as I want it.
You can also publish posts in the future. That way you wouldn’t even need cron.
You could just try the alternate WP Cron method, which doesn’t require loopbacks. Add define(‘ALTERNATE_WP_CRON’, true); to your wp-config.php file.
In your event callback function check to see if the user id the admin then run the function else just reschedule it. So using the example from the codex’s page you linked in the question it would be something like this: function my_activation() { if ( !wp_next_scheduled( ‘my_hourly_event’ ) ) { wp_schedule_event(time(), ‘hourly’, ‘my_hourly_event’); } … Read more
You shouldn’t call wp_clear_scheduled_hook on every page load, because then you’re always restarting your wp-cron shcedule, with your current setup. Additionally this call: wp_clear_scheduled_hook( ‘le_do_this’ ); doesn’t make any difference, since le_do_this isn’t a hook name in your setup. You could try for example this test plugin: <?php /** * Plugin Name: Daily WP-Cron * … Read more
You’re missing one key component. Add this to your wp-config.php: define( ‘DISABLE_WP_CRON’, true ); Here are some other helpful constants for your wp-config.php: https://gist.github.com/MikeNGarrett/e20d77ca8ba4ae62adf5
Since you need to edit theme files, you’ll first want to determine whether you’re using a custom-built theme or something that was downloaded from somewhere. If it was downloaded from somewhere, you’ll need to create a child theme (basically, you just create a new style.css file which only needs to contain comments at the top, … Read more
Yes, wp_doing_cron will return true if the current request is a WP Cron request, or if it’s triggered from WP CLI https://developer.wordpress.org/reference/functions/wp_doing_cron/
Few things come to my mind, which could help. Post status Perhaps you could use the pending post status, which you would use as a parameter in aggiorna_dati(), for the auto-generated posts that needs to be processed by funzione_recensione(). After the function is done it would change the status to something else. $args[‘post_status’] = ‘pending’; … Read more
Defining ALLOW_UNFILTERED_UPLOADS isn’t enough anymore: it doesn’t grant the capability, it just permits non-admin users who have the unfiltered_uploads capability to upload any file (except on a multisite). You also need to grant yourself the capability, e.g. from Sebastian’s answer here # # For this, see: wp-includes/capabilities.php > map_meta_cap() # function wpse_6533_map_unrestricted_upload_filter($caps, $cap) { if … Read more