artemsemkin

Untitled

Oct 19th, 2020
632
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Don't prepend default WordPress slug for CPT
  3.  */
  4. add_filter( 'register_post_type_args', 'custom_change_cpt_slugs', 10, 2 );
  5. function custom_change_cpt_slugs( $args, $post_type ) {
  6.  
  7.   switch ( $post_type ) {
  8.     case 'arts_portfolio_item':
  9.       $args['rewrite']['with_front'] = false;
  10.       break;
  11.     case 'arts_service':
  12.       $args['rewrite']['with_front'] = false;
  13.       break;
  14.     case 'arts_album':
  15.       $args['rewrite']['with_front'] = false;
  16.       break;
  17.   }
  18.  
  19.   return $args;
  20. }
  21.  
RAW Paste Data