Wp-cron with add_action

admin

Administrator
Staff member
I have these features to schedule tasks in wordpress, the code runs smoothly but the function "post", nothing prints ..

what I want to do is:
that from input data, a task is scheduled on wordpress and parameters are sent to the function that prints the values entered

Code:
 function info($nombre){

     if(!wp_next_scheduled($nombre)) {
         wp_schedule_event(time(),'hourly',$nombre,array('Hola', 'Mundo'));

            //Deployment hook

           add_action($nombre, 'post','10',2 );
               }    
        else {
            echo 'no se creo el cron para la campaña: '. $snombre;

        }



    }  

    //funcion hook
    function post($param1,$param2){
        echo "<p>Action for cron..... hook...</p>".$param1;
        echo $param2;
        }