paolo_bortolotti

incluse cpt

Jul 22nd, 2021
20
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_action( 'pre_get_posts', 'include_cpt' );
  2. function include_cpt( $query ) {
  3. global $wp_query;
  4. if ( is_page( array( 'ricerca-sport-e-corsi-mare', 'ricerca-sport-e-corsi-terra', 'ricerca-altri-sport' ) ) ) {
  5. if ( $query->is_tax() && $query->is_main_query() ) {
  6. $query->set( 'post_type', array('corsi'));
  7. }
  8. return $query;
  9. }
  10. }
RAW Paste Data