wp_schedule_event only when admin is visited

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

Schedule cron don’t work

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

Set a menu item to display during certain times

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

Detect if Cron is Running

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/

Update Content based on expiration time or queued processing

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

File Type Is Not Permitted – Cronjob

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)