Getting the post_id in wp_ajax function

Its an old question however would like to answer for other people

Within ajax function hooked to wp_ajax do this.

$url     = wp_get_referer();
$post_id = url_to_postid( $url ); 

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)