Add Custom ComboBox Filters to Admin User List in WordPress

I want to add 2 combo box in Admin User List Panel. For example the first one will be a combo box with countries and the other combo will be User Age.
So I want to add these combos in order to filter the user list.

Could you please shed some light here?.

Read More

Thank you.

Related posts

Leave a Reply

2 comments

  1. This is what i’m looking for:

    add_action('restrict_manage_posts', 'my_restrict_manage_posts');
    function my_restrict_manage_posts()
    {
      global $typenow;
    
      if ($typenow == 'your_custom_post_type') {
        $args = array(
          'show_option_all' => "Show All Categories",
          'taxonomy' => 'your_custom_taxonomy',
          'name' => 'your_custom_taxonomy'
    
        );
        wp_dropdown_categories($args);
      }
    }
    
    add_action('request', 'my_request');    
    function my_request($request)
    {
      if (is_admin() && $GLOBALS['PHP_SELF'] == '/wp-admin/edit.php' && isset($request['post_type']) && $request['post_type'] == 'your_custom_post_type') {
        $request['term'] = get_term($request['your_custom_taxonomy'], 'your_custom_taxonomy')->name;
      }
      return $request;
    }
    
  2. You can add your own fields to a user add/edit field.
    this example shows how to add a address input field, if you get this working try switching it with the dropdown’s that you need. If that’s what you mean by ‘combobox’

    function fb_add_custom_user_profile_fields( $user ) {
    ?>
        <h3><?php _e('Extra Profile Information', 'your_textdomain'); ?></h3>
        <table class="form-table">
        <tr>
        <th>
        <label for="address"><?php _e('Address', 'your_textdomain'); ?>
        </label></th>
        <td>
        <input type="text" name="address" id="address" value="<?php echo esc_attr( get_the_author_meta( 'address', $user->ID ) ); ?>" class="regular-text" /><br />
        <span class="description"><?php _e('Please enter your address.', 'your_textdomain'); ?></span>
        </td>
        </tr>
        </table>
        <?php }
        function fb_save_custom_user_profile_fields( $user_id ) {
        if ( !current_user_can( 'edit_user', $user_id ) )
        return FALSE;
        update_usermeta( $user_id, 'address', $_POST['address'] );
        }
        add_action( 'show_user_profile', 'fb_add_custom_user_profile_fields' );
        add_action( 'edit_user_profile', 'fb_add_custom_user_profile_fields' );
        add_action( 'personal_options_update', 'fb_save_custom_user_profile_fields' );
        add_action( 'edit_user_profile_update', 'fb_save_custom_user_profile_fields' );