title: Wordpress How to add Admin Custom Column Sorting by display value
body: <p>In Wordpress, is there a way to make a custom column sortable by the display value instead of the meta_value? What I mean is that my meta value is a number, but I've manipulated that number with an existing hook for it to be a string. I'd like to sort by that string instead of the number. This is my existing, working code that will sort it just fine - it just won't be in alphabetical order:</p>
  
  <pre><code>add_action('manage_resource_posts_custom_column', 'my_manage_resource_columns', 10, 2);
  function my_manage_resource_columns($column_name, $id) {
      switch ($column_name) {
      case 'type':
          $id = get_the_ID();
          $par = get_field('resource_type',$id);
          $type = get_field('singular_name',$par);
          echo $type;
              break;
      default:
          break;
      }
  } 
  
  add_filter( "manage_edit-resource_sortable_columns", "my_last_modified_column_register_sortable" );
  function my_last_modified_column_register_sortable( $columns ) {
      $columns["type"] = "type";
      return $columns;
  }
  
  add_filter( "request", "sort_column_by_modified" ); 
  function sort_column_by_modified( $vars ){
      if ( isset( $vars["orderby"] ) &amp;&amp; "type" == $vars["orderby"] &amp;&amp; $_GET['post_type']=='resource') {
          $vars = array_merge( $vars, array(
              'meta_key' =&gt; 'resource_type',
              'orderby' =&gt; 'meta_value_num'
          ) );
      }
      return $vars;
  }
  </code></pre>
  
  <p>So you can see where I add the actual text for the column name based on the numeric value in the database. It displays fine. I just need it to be sortable by that text and not the value it represents. Does anyone know if this is possible / how to do it?</p>
  
  <p>Here is a screen shot of the column as it is now. You can see that they are indeed grouped up by type, but its by numerical order of the ID</p>
  
  <p><img src="https://i.stack.imgur.com/gJbUZ.png" alt="enter image description here"></p>
  
  <p>Thanks in advance!</p>