<pre><code> function getIdFromMeta( $meta_key, $meta_value ) { global $wpdb; $pid = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_value = '$meta_value' AND meta_key = '$meta_key' ORDER BY post_id DESC") ); if( $pid != '' ) return $pid; else return false; } </code></pre> it is work fine for me this solution give me [Rochester Oliveira][1] my question on [stackoverflow][2] Thanks Rochester Oliveira [1]: https://stackoverflow.com/users/609870/rochester-oliveira [2]: https://stackoverflow.com/questions/5450092/how-to-get-post-id-from-post-meta/5467348#5467348 this return post id but i needed nav menu id