How do I create a custom exposed filter?
There's a module that provides some examples here: https://www.drupal.org/project/views_plugin_examples.  It's limited but has an exposed filter example.

General discussion here:  https://api.drupal.org/api/views/views.api.php/group/views_plugins/7

In broad outline:


Create a custom module, with a subdirectory called "views"
In your .info file, add a line:  files[] = views/MODULE_handler_filter_FILTERNAME.inc Your filter will never show up if you forget this!
In the .module file, add an implementation of hook_views_api():

function MODULE_views_api() {
  return array(
    'api' =&gt; 3,
    'path' =&gt; drupal_get_path('module', 'MODULE') . '/views',
  );
}

Within the views subdirectory, you will need to create two files, MODULE.views.inc and MODULE_handler_filter_FILTERNAME.inc
In MODULE.views.inc, you will need to implement either:


hook_views_data_alter() - for a new filter on an existing entity type that already has views integration, which is more common OR 

hook_views_data() - to provide views integration for your custom entity, including filters.  

API documentation is available for both functions. 

A quick example:

    function MODULE_views_data_alter(&amp;$data) {
       if ( isset($data['users']) &amp;&amp; !isset($data['users']['FILTERNAME']) ) {
        $data['users']['FILTERNAME'] = array(
          'real field' =&gt; 'uid', // name of entity field to which filter applies
          'title' =&gt; t('HUMAN READABLE NAME OF FILTER'),
          'help' =&gt; t('HELP TEXT'),
          'filter' =&gt; array(
            'handler' =&gt; 'MODULE_handler_filter_FILTERNAME',
          ),
        );
      }
    }



All of the real work happens in MODULE_handler_filter_FILTERNAME.inc. This file defines a new class that implements your filter, class MODULE_handler_filter_FILTERNAME.  


You will usually want to extend one of the existing views filter handler classes to get the benefit of existing code.  Many of these can be found in subdirectories of the views module directory.  The basic filters are in the "handlers" subdirectory, but many more complex filters may be found buried in subdirectories of the "modules" subdirectory.  The views filter handlers you find there are the best documentation for how to implement a filter, as well as how to extend an existing filter, and you should read through them.  

Normally your custom filter class will a) add fields to the extended filter's settings form, b) in the case of an exposed filter, modify the exposed widget, and then c) implement a query() method that does the real work, based on the saved settings and input from the exposed widget.