WordPress.org

Ready to get started?Download WordPress

Forums

Get the $post array when a scheduled post is made live (1 post)

  1. christopherross
    Member
    Posted 3 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by christopherross
  • This topic is not resolved
  • WordPress version: 3.0.5