• Whenever someone clicked the Expiration Date column to sort it, WordPress returned an empty set. I got sorting working properly by adding the following code to the plugin:

    function expirationdate_column_orderby($vars){
    	if(isset($vars['orderby']) && 'expirationdate' == $vars['orderby'] ) {
    		$vars = array_merge($vars, array(
    			'meta_key' => '_expiration-date',
    			'orderby' => 'meta_value_num'
    		));
    	}
    
    	return $vars;
    }
    add_filter('request','expirationdate_column_orderby');

    If you’re on GitHub I can submit a pull request.

    http://ww.wp.xz.cn/plugins/post-expirator/

The topic ‘Sorting Posts by Expiration Date (patch included)’ is closed to new replies.