How to provide a default sort on a custom search?
Custom searches inherit CRM_Contact_Form_Search_Custom_Base; check out the addSortOffset() function below (around line 177) to see how the sort is tacked onto the query:

public function addSortOffset(&amp;$sql, $offset, $rowcount, $sort) {
    if (!empty($sort)) {
      if (is_string($sort)) {
        $sort = CRM_Utils_Type::escape($sort, 'String');
        $sql .= " ORDER BY $sort ";
      }
      else {
        $sql .= " ORDER BY " . trim($sort-&gt;orderBy());
      }
    }
    if ($rowcount &gt; 0 &amp;&amp; $offset &gt;= 0) {
      $offset = CRM_Utils_Type::escape($offset, 'Int');
      $rowcount = CRM_Utils_Type::escape($rowcount, 'Int');
      $sql .= " LIMIT $offset, $rowcount ";
    }
  }


If you want to use an array it will send it to CRM_Utils_Sort::orderby(). I think you can set your $sort like this:

if (!$justIDs &amp;&amp;!sort) {
  $sort = array (
    'name' =&gt; 'civicrm_created_date',
    'direction' =&gt; 1,
  );
}


Would that work for you?