I need a hook such that when visitor lands on any of the post (not page), I need to record a hit.
How can I find whether the request is for post, and is there any hook to find if the loaded content is post, and if yes, what is post id
something like this will work:
function record_hit_if_post(){
global $wp_query;
if($wp_query->is_single==1)
// single post's ID:
// $wp_query->post->ID;
}
add_filter('template_redirect', 'record_hit_if_post');