Skip to main content
1 of 2
Rob Myrick
  • 305
  • 4
  • 18

Saving fields in a drop-down in Wordpress

Below is code that successfully displays a drop-down menu of page templates in my Wordpress theme. I'm using this menu in a custom post type, and don't quite understand how to label it in order to make it save the chosen value after the user "updates".

The value is, in fact, being saved to the database and displaying correctly to the table, it's just not maintaining the chosen value after update.

I've seen some other examples of this, but my drop-down is based on a PHP function all in one line. Any suggestions would be great appreciated.

<label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label>

<select name="page_template" id="page_template">

<option value='page_template'><?php _e('Default Template'); ?></option>
<?php page_template_dropdown($template); ?>
</select>
Rob Myrick
  • 305
  • 4
  • 18