I researched but did not find right answer to my question

I have custom post type for states, cities and countries and would like to set the default value in the country list for “Argentina”, but do not know how to solve it.

see my code:

<select name="pais" class="pais-select">
                <option value="">País</option>
                <?php
                    $pais = diretorio_request('pais');
                    foreach(diretorio_countries() as $country) {
                ?>
                <option value="<?php echo $country; ?>"<?php echo ($pais == $country) ? ' selected="1"' : ''; ?>><?php echo $country; ?></option>
                <?php
                    }
                ?>
            </select> 

I tried something like ‘selected = “selected”‘ but does not mark Argentina scored Zimbábue

Read more here: WordPress - default value in selected dropdown with CPT


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: