• Resolved John Parker

    (@jpwebcast)


    Hello, I am getting this notice in my log file and in the hreflang selection box within the post:
    PHP Notice: Undefined variable: href_lang in {MY_PATH}/plugins/hreflang-tags-by-dcgws/includes/functions.php on line 227

    I added $href_lang = ‘x-default’; to line 218 and that removed the error and populated the languages in the dropdown. Although, i’m not sure if x-default is the setting the conditional statement is supposed to be looking for, or if it is checking which language is selected.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @jpwebcast

    Thanks for your message. Actually, since count($keys) has to equal 0 for this block to render, then there would be no selected dropdowns. So, in lines 226-230 you can safely change:

    echo '<option value="'.$lang.'"';
    if ($lang == $href_lang) {
    echo ' selected="selected"';
    }
    echo '>'.$lang_array['english_name'].'</option>';

    to

    echo '<option value="'.$lang.'"'>'.$lang_array['english_name'].'</option>';

    Hope this helps

    Hi @jpwebcast

    Thanks for your message. Actually, since count($keys) has to equal 0 for this block to render, then there would be no selected dropdowns. So, in lines 226-230 you can safely change:

    echo '<option value="'.$lang.'"';
    if ($lang == $href_lang) {
    echo ' selected="selected"';
    }
    echo '>'.$lang_array['english_name'].'</option>';

    to

    echo '<option value="'.$lang.'"';
    echo '>'.$lang_array['english_name'].'</option>';

    Hope this helps

    • This reply was modified 6 years, 9 months ago by David Davis.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Undefined variable $href_lang’ is closed to new replies.