Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. 'rewrite' => array( "slug" => "myplugin", "with_front" => true )
  2.  
  3. function cpt_add_rewrite_rules() {
  4. $cpt='events';
  5. add_rewrite_rule($cpt.'/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})?$',
  6. 'index.php?post_type='.$cpt.'&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]',
  7. 'top');
  8.  
  9. add_rewrite_rule($cpt.'/([0-9]{4})/([0-9]{1,2})?$',
  10. 'index.php?post_type='.$cpt.'&year=$matches[1]&monthnum=$matches[2]',
  11. 'top');
  12.  
  13. add_rewrite_rule($cpt.'/([0-9]{4})?$',
  14. 'index.php?post_type='.$cpt.'&year=$matches[1]',
  15. 'top');
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement