Title: Current post id
Last modified: August 31, 2016

---

# Current post id

 *  Resolved [Paul](https://wordpress.org/support/users/eartboard/)
 * (@eartboard)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/current-post-id/)
 * Hello,
 * I use rwmb_meta_boxes filter to register some meta boxes for a custom post type.
 * I need to make a conditional check inside the filter. I tried a lot of methods
   to get the current post id with no luck. Is there any way to get the current 
   post id?
 * Thank you.
 * [https://wordpress.org/plugins/meta-box/](https://wordpress.org/plugins/meta-box/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Anh Tran](https://wordpress.org/support/users/rilwis/)
 * (@rilwis)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/current-post-id/#post-7391600)
 * You can use this snippet to get current post ID:
 *     ```
       $post_id = false;
       if ( isset( $_GET['post'] ) ) {
       	$post_id = intval( $_GET['post'] );
       }
       elseif ( isset( $_POST['post_ID'] ) ) {
       	$post_id = intval( $_POST['post_ID'] );
       }
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Current post id’ is closed to new replies.

 * ![](https://ps.w.org/meta-box/assets/icon-128x128.png?rev=1100915)
 * [Meta Box](https://wordpress.org/plugins/meta-box/)
 * [Support Threads](https://wordpress.org/support/plugin/meta-box/)
 * [Active Topics](https://wordpress.org/support/plugin/meta-box/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/meta-box/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/meta-box/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Anh Tran](https://wordpress.org/support/users/rilwis/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/current-post-id/#post-7391600)
 * Status: resolved