title: How to get current post_id in function.php file
body: <p>This is my function in function.php file</p>
  
  <pre><code>  function getcity(){
      global $wpdb;
  
      if($_POST['state'])
              {
                  $id=$_POST['state'];
                  $district = get_post_meta(get_the_ID() , 'district', true);
  
                                       var_dump($district);
                  $result=$wpdb-&gt;get_results("SELECT * FROM districts WHERE state_id='$id'");
  
                                                         foreach($result as $row) {
                                                               $district_name   = $row-
    &gt;district_name;
                               $district_id     = $row-&gt;district_id;
  
                              echo '&lt;option value="'.$district_id.'"&gt;'.$district_name.'&lt;/option&gt;';
  
  
              }
       }
     }
   add_action("wp_ajax_nopriv_getcity", "getcity");
   add_action("wp_ajax_getcity", "getcity");
  </code></pre>
  
  <p>I want to get current post id in this function to display selected dropdown value..</p>