• Hi, i have some problem to show the user the selected value the user has selected before.

    i have custom post type i have created and i have also some Separated plugin that using custom db.

    what i have done is make dropdowm menu with all the custom posts (show posts name) and then the user choose what custom post he need to get the post link. then i copy the post permalink into var and uptade the permalink into plugins DB.
    Here is the code that print all “custom post type”

    <select class="edit-link-field" name="link[<?php echo $id ?>]">
                    <?php
                    $args = array(
                        'post_type' => 'test_reviews',
                        'position' => 'pastor'
                    );
                    $pastorList = new WP_Query($args); while ($pastorList->have_posts()) : $pastorList->the_post();
        		    $postID = get_the_ID();
                        $is_selected = (get_the_title() == $selected) ? 'selected="selected"' : '';
                        echo '<option value="'.get_permalink( ).'" '.$is_selected.'>'.get_the_title().'</option>';
    
                    endwhile; wp_reset_postdata();
        		    $test = get_permalink( );
    
                    ?>
          </select>

    so what i need now is the same dropdown menu but with selected value that the user selected. and if the user will change the select value and will push on the “update button” it will update the new permalink to DB

    Thanks For Help!

  • The topic ‘show selected value in dropdowm menu’ is closed to new replies.