Here is an example of a function that is triggered once a post "reservation" has been created :
function new_reserv()
{
$args = array( 'post_type' => 'reservations', 'posts_per_page' => 10 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
// DO some action
endwhile;
}
add_action( 'publish_reservations', 'new_reserv');
So, the problem is that when creating the FIRST post "reservation", with the hook "publish" the variable "$loop" is empty, i.e, this hook does not allow to work on the post one just created.
Anyone knows a way to retrieve posts' infos as soon as it get created ?
Thank you