Please read carefully about wp_schedule_single_event in Codex. As you can see, there is a third argument $args
.
You can schedule a singule WP_Cron
event by modifying the function you use above and passing arguments as third parameter:
<?php
// Your basic hook schelduling...
wp_schedule_single_event( time() + 30, 'user_cron_event',
array(
'user_id' => $user_id,
'oldmoney' => $oldmoney,
'totalprice' => $totalprice
)
);
and your base action in this case…
add_action('user_cron_event', 'user_cron_event_callback');
function user_cron_event_callback($args){
update_user_meta( $args['user_id'], 'money', $args['oldmoney']-$args['totalprice']);
}
Related Posts:
- How to represent “event” in a UML Class Diagram?
- How to test wp_cron?
- Recommendation for a WordPress Calendar Plugin with Recurring Events? [closed]
- Post date vs. event date in WordPress
- Looking for a simple calendar/events plugin [closed]
- Create a custom event post
- Show events date instead of article date in default calendar widget
- how to set array of args for scheduled event?
- Events plugin for irregular / complex events [closed]
- How to get an event to fire using Google Tag Manager for the wordpress audio player?
- Event Organiser: Event list includes regular Posts & custom fields? [closed]
- Single Events as Sub-Page to Main Calendar Page
- Reverse order of events on homepage [closed]
- Event booking form for wordpress
- Plugin: Events manager – Next and previous event
- Event Management plugin
- How to Create Events Calendar
- Group the events post in month+year format?
- how can create carousel for posts that will be published a month later?
- Upcoming events
- Add option in th event calendar
- Post Terms As Class Name For Full Calendar Events
- Need to build a community membership and event/ticketing system
- jQuery equivalent of JavaScript’s addEventListener method
- What’s the difference between event.stopPropagation and event.preventDefault?
- How to set a timer in mysql
- What does on() in JavaScript do?
- Javascript removeEventListener not working
- Jquery .on(‘scroll’) not firing the event while scrolling
- How to use pygame.KEYDOWN to execute something every time through a loop while the key is held down?
- How to block until an event is fired in c#
- How to handle a Button click event
- jQuery multiple events to trigger the same function
- Angular 2 Hover event
- onKeyDown event not working on divs in React
- onclick event pass
- id or value
- Fire oninput event with jQuery
- Why onbeforeunload event is not firing
- How can I capture the right-click event in JavaScript?
- WordPress: schedule multiple action hooks of the same name and time
- How to run a function every 5 minutes?
- WP Cron Doesn’t Execute When Time Elapses
- WordPress Media Uploader events
- How to set a custom post type to have viewable future posts
- Scheduled events disappear from events queue
- trigger save_post event programmatically
- How to capture the selection:toggle event fired by wp.media
- Only Showing Upcoming Events
- How do I search events between two set dates inside WP?
- wp_schedule_event not working?
- Manipulate post category after time
- How to create collections that are edited in admin?
- All-in-One Event Calendar: Custom Query – Getting each event Instance [closed]
- How Do I Make WordPress Run an Event Every Day?
- Plugin for event management? [closed]
- Loading Custom Post Type Events into jQuery-based FullCalendar?
- Custom Post Type “Event”: chronological list of recurring events
- The holy grail of Event Management Plugins? [closed]
- Is there a WordPress Event Manager that links with your user database?
- How to trap “Publish” button to check for meta box validation?
- Conference website with ticket-sales + sponsorship sales with WordPress?
- sort events based on event date custom field
- Archive by custom post type and custom date field
- Filtering more than one term in a taxonomy in WP
- How can I invoke an action after a CiviCRM triggering event?
- Conference ticketing and seating module for WordPress [closed]
- WordPress Plugin for One-Time Event Registration? [closed]
- How to use get_categories() with Event Organiser plugin
- Short code for Venues
- javascript is not working on Event Submission?
- WP_Query meta_query results date by date
- What is the Javascript event for an item being added to the cart in Woocommerce?
- Plugin allowing for artists, events and venues
- 1 day after custom date change post status to draft
- Custom Post Type Events Archive Grouped By Month
- Looking for a subscriber list management system
- Why is wp-cron only executing on page visit?
- Trigger background job using AJAX
- How to select events within current week using wp_query
- Plugin: Events Manager – Search by start date only
- RSVP form for Facebook events from a WordPress post?
- Save metadata as a timestamp, display as a “pretty” date
- Sorting WordPress Posts via Custom Field Values?
- How to display upcoming events by dat with Modern Events Calendar Lite
- Events Made Easy Plugin – Duplicate Title Tags
- WordPress Scheduled Event Request Blocking
- Event-Driven Pattern vs MVC?
- scrolltop always 0, can’t trigger script
- Only show upcoming event or current events
- Display posts with a start OR end date later than current date
- Calendar Solution: Handling upcoming Dates with Posts?
- Display upcoming Events for next 7 Days
- Events Plugin that works with existing categories?
- How to order posts by one custom field and filter them by another one?
- What plugin should I use for booking events and receiving payments? [closed]
- CPT EVENT – listing by month and filtering by category and month – form select option
- List of JS Events for Widgets?
- Update a costume wp_usermeta key back to 0 every 24hours (time can be specified as needed)
- Calling plugin function inside custom plugin for onclick event
- Wp_schedule_event functions.php