[wp-hackers] hooks & future posts
Peter Westwood
peter.westwood at ftwr.co.uk
Sun Sep 20 16:13:31 UTC 2009
On 20 Sep 2009, at 13:03, Ozh wrote:
> Still can't do sh*t with this function.
> Bleh :/
> There's obviously something I don't get.
>
Just tested this on my local install (2.9-rare) with the following code:
<?php
add_action('future_to_publish', 'do_stuff', 10, 1);
function do_stuff( $in ) {
$f = fopen( dirname(__FILE__).'/log.log', 'a' );
fwrite( $f, "\nBefore\n" );
fwrite( $f, print_r($in, true) );
fwrite( $f, "\nAfter\n" );
fclose( $f );
return $in;
}
?>
Scheduled a post for a couple of mins in the future and refreshed the
page to get cron to run.
And got this in log.log:
---------------
Before
stdClass Object
(
[ID] => 496
[post_author] => 1
[post_date] => 2009-09-20 17:10:47
[post_date_gmt] => 2009-09-20 16:10:47
[post_content] => Content
[post_title] => Future Forward
[post_excerpt] =>
[post_status] => publish
[comment_status] => open
[ping_status] => open
[post_password] =>
[post_name] => future-forward
[to_ping] =>
[pinged] =>
[post_modified] => 2009-09-20 17:09:20
[post_modified_gmt] => 2009-09-20 16:09:20
[post_content_filtered] =>
[post_parent] => 0
[guid] => http://localhost/wordpress-trunk/?p=496
[menu_order] => 0
[post_type] => post
[post_mime_type] =>
[comment_count] => 0
[ancestors] => Array
(
)
[filter] => raw
)
After
------------
Cheers
Peter
--
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5
More information about the wp-hackers
mailing list