Advertisement
buddydev

Untitled

Apr 7th, 2023
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. /**
  2.  * Filter ids.
  3.  *
  4.  * @param array $post_ids post id.
  5.  *
  6.  * @return array
  7.  */
  8. function bpgtc_filter_active_post_ids( $post_ids ) {
  9.  
  10.     return $post_ids;
  11.     if ( empty( $post_ids ) ) {
  12.         return $post_ids;
  13.     }
  14.  
  15.     if ( ! function_exists( 'wpml_get_current_language' ) ) {
  16.         return $post_ids;
  17.     }
  18.  
  19.     static $current_lang_post_ids;
  20.     if ( is_null( $current_lang_post_ids ) ) {
  21.         global $wpdb;
  22.         $current_lang_post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT element_id FROM {$wpdb->prefix}icl_translations WHERE language_code = %s AND element_type = 'post_bpgtc_group_tab'", wpml_get_current_language() ) );
  23.     }
  24.  
  25.     return array_intersect( $post_ids, $current_lang_post_ids );
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement