You’re probably attempting to add this too early. Wait for init
.
add_action(
'init',
function () {
if ( ! wp_next_scheduled( 'send_booking_expiration_hook' ) ) {
wp_schedule_event( strtotime( '12pm' ), 'hourly', 'send_booking_expiration_hook' );
}
}
);
Related Posts:
- Multiple wp_schedule_event cron jobs in plugin cause multi-execution
- Converting timestamps to local time with date_l18n()
- Using register_activation_hook in classes
- WordPress and event-driven programming – what is it about?
- Change the footer text on the login page
- How to remove a metabox from menu editor page?
- Initialize WordPress environment to use in a real cron script
- WooCommerce: How to display item meta data in email confirmation using woocommerce_order_item_meta_end
- How to make sure that only one wp_cron() runs at a time?
- Audio Player not loading when the content is loaded through Ajax, MediaElement.js no applied
- How to Remove a Filter from the Admin List Table?
- wp_delete_auto_drafts() deletes links in menus
- Woocommerce, recognize the loop of related products
- How To Change The Html of Products filtration sidebar in Woocommerce?
- Does wp-cron runs all tasks scheduled at same time together or one after other?
- How to start a script from cli within wordpress
- Insert all post IDs in new database table
- action hook wp_head higher priority as all other plugins/hooks
- How to add a second ‘place order’ button in WooCommerce [closed]
- How to do multiple searches (with logical OR) in WP_Query in hook pre_get_posts?
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- Setting up 2 SMTP accounts: 1 for wordpress and 1 for woocommerce
- wp_loaded hook block script enquequing
- Remove an action hook within a Class
- How to pass arguments to add_action() or retrieve return value of called function?
- hook that when page is starting to load
- How to change home or site url using action hooks or filter?
- Edit incorrect password message WordPress
- Cron events are disappearing, or cannot be updated in WordPress
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Remove metabox from WordPress menu editor page?
- Add a product to checkout via form
- Why ajax doesn’t work on certain wordpress hooks and reload the page instead?
- Why ajax doesn’t work on certain wordpress hooks?
- How to add an arrow to menu items has submenus
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- Don’t insert if permalink is the same?
- Return a numerical function value in Customizer controls
- How wp-cron can run in background if PHP is single threaded?
- running wp-cron.php using php not wget
- edit_comment_link is not showing for comment author
- Best way to schedule daily change in CSS parameter
- Adding function to Genesis genesis_header [closed]
- Why does wp_head hook my functions to the beginning of my source code?
- Pass argument to event hook
- Password minimum length in personal subscription [closed]
- Theme activation hook in php class
- Scheduling an event inside plugin class is not working
- How to catch wordpress post ID when it’s published
- Why does the post_type_link hook everything twice?
- How can I hook into the wp_mail function used by BackWPup?
- Can not add admin notices from the edit_user_profile_update hook (notices not being displayed)?
- Adding function to child theme’s function.php
- WordPress cron is running with previously set time intervals and not the updated one
- Add a custom class to the body tag using custom fields
- Why doesn’t global $wp_query not get hooked?
- How to pass hook variable to function?
- Can/should we delete wordpress cron jobs with no action?
- Filter wordpress posts without searching the keywords in the post content
- How do I add a function to parent theme
- Display custom field value in woocommerce variable product via jQurey
- Use wp_head hook on template page
- Setting up a cron job to auto update a custom field
- Adding custom field to product category and show it to shop/category shop page
- Preserving backslashes in post_content
- How to edit post meta data before publishing the post it self wordpress?
- Multiple cron jobs vs daily cron job doing multiple things? Which one yields better performance and scalability?
- Call a single function on two different methods with hooks
- Get original value in save_post action hooka
- Discount in the specific product title using keyword ( Woocoommerce )
- get Woocommerce product format json for WP_Query
- Register/enqueue scripts only on certain admin pages
- Is there an option to execute javascript file only on plugin activation
- How do I remove an action hook inside a class that is called by another class?
- Help hooking into user_register
- Cron not sending wp-mail()
- Automatically delete posts one by one depending on published time
- Use WP Cron to Clear a Page Cache?
- Hook into all password resets in WordPress and get password before hashing?
- Update all posts in custom post types with wp_cron()?
- Why transition_post_type hook is called twice for the same post?
- Sort WooCommerce data with WP-CRON?
- Clone the “proceed to cart” button and place it above checkout on the cart page, but only appear display size is 320px
- How can I move the posted-on date above the post and below the entry-header?
- How do I routinely extract the thumbnail of the most recent post?
- Passing link parameter values to form
- Post formating on Home page
- WordPress HTML Helper
- calling a function from a class in your template
- How to execute add_action() function from custom plugin to Crontrol plugin or do_action()?
- For each loop will not append to the_content hook
- Change Checkout “Place Order” text if cart has a specific product
- How to avoid timeout waiting for output from CGI script?
- Error resetting database index using ALTER TABLE in $wpdb->query
- transition_post_status hook, works – but not if the post is new
- php was updated – critical error [closed]
- Guests comment form – prevent duplicate email addresses
- Woocommerce – add tracking code to another email template
- Background Tasks in a WP Cronjob?