芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitio.in/wp-content/plugins/the-events-calendar/src/Tribe/Repositories/Linked_Posts.php
default_args = [ 'post_type' => Tribe__Events__Venue::POSTTYPE, // We'll be handling the dates, let's mark the query as a non-filtered one. 'tribe_suppress_query_filters' => true, ]; $this->schema = array_merge( $this->schema, [ 'event' => [ $this, 'filter_by_event' ], ] ); } /** * Filters linked post types by a specific event of set of events. * * @since 4.9 * * @param int|WP_Post|array $event Post ID, Post Object, or an array of Post IDs or Objects. */ public function filter_by_event( $event ) { if ( ! $this->linked_id_meta_key ) { return; } $events = (array) $event; $post_ids = array_map( [ 'Tribe__Main', 'post_id_helper' ], $events ); $post_ids = array_filter( $post_ids ); $post_ids = array_unique( $post_ids ); if ( empty( $post_ids ) ) { return; } $in_pattern = array_fill( 0, count( $post_ids ), '%d' ); $in_pattern = implode( ', ', $in_pattern ); global $wpdb; $this->filter_query->join( $wpdb->prepare( " JOIN {$wpdb->postmeta} linked_posts_event ON ( {$wpdb->posts}.ID = linked_posts_event.meta_value AND linked_posts_event.meta_key = %s ) ", $this->linked_id_meta_key ) ); $this->filter_query->where( $wpdb->prepare( "linked_posts_event.post_id IN ( {$in_pattern} )", $post_ids ) ); } }