I'm in a dead end with a schedualed task in a wordpress plugin for a multisite. Somehow the action I added don't get triggered. The task is getting schedualed and returns a timestamp when I run wp_next_scheduled(), but the action itself doesn't go off and trigger the function.

UPDATE

Solution: Create a global function and call that from the custom action.

Apparently is there some glitch with creating custom actions while refering to an object. Since custom actions is stored in the DB (as far as I've understood), the objected won't be instansiated and therefor can't use it's methods. Therefor: back to basics and use a global function.

This question came from our site for professional and enthusiast programmers.

Are you 100% sure it's not getting called? Try logging something to file as the first line of your action - it may be that it is being called but causing a fatal error before anything useful happens.
–
DaveRandomSep 26 '11 at 11:16

Has a file_put_contents() in the first line, that works when the method is called outside the action. No success, though. Thx for the answer, btw.
–
user534736Sep 26 '11 at 11:34

Where / when do you instantiate your class? Ensure the action is registered and the class instantiated when wpcron gets fired.
–
hakreSep 26 '11 at 11:35

Is that really required? Since I'm running it on init and conditioned the wp_schedule_event to only run only if the job doesn't exists I'd figured it would be working anyway. Hmm. No can't be it. It does return a timestamp, so the shedualed task exists. It seems like its the action that isn't working.
–
user534736Sep 26 '11 at 11:27