pustakakoran

Menyembunyikan Post di Acrhive

Aug 22nd, 2019
126
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function my_custom_get_posts( $query ) {
  2. if ( is_admin() || ! $query->is_main_query() )
  3. return;
  4.  
  5. if ( $query->is_archive() ) {
  6. $query->set( 'post__not_in', array( 7, 11, 21 ) );
  7. }
  8. }
  9. add_action( 'pre_get_posts', 'my_custom_get_posts', 1 );
  10.  
  11. angka 7, 11, 21 adalah ID Post yang mau disembunyikan
RAW Paste Data