title: Can't Get Wordpress Post ID to Echo or Insert into Database
body: <p>I've got this code written that when a link is clicked is supposed to insert the current user's id, the current post's id, and the date into a database. The current user id &amp; the current date get inserted into the database and echo's perfectly, but I can't get the current post's id to "echo" or get it to insert into the database. Here's the code I have so far:</p>
  
  <pre><code>global $post;
      global $wpdb;
      $wp_user_id = get_current_user_id(); 
      $activity_post_id = $wp_query-&gt;post-&gt;ID;
      $activity_added = current_time('mysql', 1);
  
      echo "&lt;h2&gt;The Current User ID is: ". $wp_user_id . "&lt;/h2&gt;";
      echo "&lt;h2&gt;The Current Activity ID is: ". $activity_post_id . "&lt;/h2&gt;";
      echo "&lt;h2&gt;The Current Date / Time is: ". $activity_added . "&lt;/h2&gt;";
  
      $wpdb-&gt;insert(
          'wp_growwellactivities',
          array(
              'wp_user_id' =&gt; $wp_user_id,
              'activity_post_id' =&gt; $activity_post_id,
              'date_added' =&gt; $activity_added
          )
      ); 
  </code></pre>