• Hi all,

    Silly problem to have but hopefully you guys can help me solve it.

    I have a function that gets called whenever a post is published and it works like a charm except with a scheduled post is made live, the $post variable is empty but, it triggers the code.

    The result, is that 99% of the time posts trigger the function correctly. In the rare example of a scheduled post, the function is triggered but with an empty array.

    Can anybody suggest where to begin? Neither the $post_id or $post are populated in this one circumstance.

    Here’s the code:

    function stocktwits_curation_send_report($post_id, $post) {
    	//extract data from the post
    	extract($_POST);
    
    	//set POST variables
    	$fields = array(
    				'post'=>urlencode(json_encode($post)),
    			);
    	//url-ify the data for the POST
    	foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
    	rtrim($fields_string,'&');
    
    	// do fancy curl stuff here
    
    }

    thanks!

  • The topic ‘Get the $post array when a scheduled post is made live’ is closed to new replies.