Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

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;
}

it is work fine for me this solution give me Rochester OliveiraRochester Oliveira my question on stackoverflowstackoverflow Thanks Rochester Oliveira

this return post id but i needed nav menu id


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;
}

it is work fine for me this solution give me Rochester Oliveira my question on stackoverflow Thanks Rochester Oliveira

this return post id but i needed nav menu id


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;
}

it is work fine for me this solution give me Rochester Oliveira my question on stackoverflow Thanks Rochester Oliveira

this return post id but i needed nav menu id

added 46 characters in body
Source Link
Anjum
  • 974
  • 8
  • 13

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;
}

it is work fine for me this solution give me Rochester Oliveira my question on stackoverflow Thanks Rochester Oliveira

this return post id but i needed nav menu id


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;
}

it is work fine for me this solution give me Rochester Oliveira my question on stackoverflow Thanks Rochester Oliveira


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;
}

it is work fine for me this solution give me Rochester Oliveira my question on stackoverflow Thanks Rochester Oliveira

this return post id but i needed nav menu id

Source Link
Anjum
  • 974
  • 8
  • 13


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;
}

it is work fine for me this solution give me Rochester Oliveira my question on stackoverflow Thanks Rochester Oliveira