Skip to content

Instantly share code, notes, and snippets.

@norcross
Created November 5, 2014 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save norcross/311a8e31e450e0eb4a14 to your computer and use it in GitHub Desktop.
Save norcross/311a8e31e450e0eb4a14 to your computer and use it in GitHub Desktop.
remove the month drop down from post types
<?php
add_filter( 'months_dropdown_results', 'rkv_remove_month_filters' ), 10, 2 );
/**
* remove the month drop down filter by
* spoofing WP and saying that none exist
* for specific post types
*
* @param array $months the original count
* @param string $post_type the post type
* @return array an empty array or the original array
*/
function rkv_remove_month_filters( $months, $post_type ) {
return in_array( $post_type, array( 'page' ) ) ? array() : $months;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment