get_post_meta() returns empty

I’m doing a basic shortcode for translating a text in the footer of a wordpress site, and I’m using the get_post_meta() for identifing the language in a meta tag (which I’m adding with a plug in for inserting html code in the header) but it returns empty I’m wondering if this is because the plugin and the order in which he creates the elements(first he executes my shortcode and then the plugin) or if it is something else.

function text_Footer($atts, $content=null){ 

    extract(shortcode_atts(array(
            'id' => ''
    ), $atts));
    $ID = get_the_ID();
     $lang = get_post_meta(ID,'language',true);
    if($lang == 'portuguese')
    {
    $output='<p>Text in portuguese</p>';
    }
    else
    {
    //echo $lang."nope";
    $output = '<p>Text in spanish</p>';
    }
    return $output;
}


Source: shortcode

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.