Support General Post ID within rwmb_meta_boxes filter Reply To: Post ID within rwmb_meta_boxes filter

#11915
Anh TranAnh Tran
Keymaster

Hi Jason,

The problem is meta boxes are registered and run before any WP query, so all the template functions won't work.

If you're going to get in the back end, then please use this code:

$post_id = false;
if ( isset( $_GET['post'] ) ) {
    $post_id = intval( $_GET['post'] );
} elseif ( isset( $_POST['post_ID'] ) ) {
    $post_id = intval( $_POST['post_ID'] );
}