Advertisement
SergeyBiryukov

Untitled

Oct 1st, 2014
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. function check_for_numeric_page_slug( $query_vars ) {
  2.     if ( ! empty( $query_vars['year'] ) ) {
  3.         $page = get_page_by_path( $query_vars['year'] );
  4.         if ( $page ) {
  5.             $query_vars['pagename'] = $page->post_name;
  6.             unset( $query_vars['year'] );
  7.         }
  8.     }
  9.  
  10.     return $query_vars;
  11. }
  12. add_filter( 'request', 'check_for_numeric_page_slug' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement