Wishlist Member: Sorting the posts by membership levels
…that posts on the specific Wishlist Member level * are first in the results. * * @param array $hits Contains the posts in $hits[0]. * * @return array The $hits array, filtered. */ function rlv_free_posts_first( $hits ) { $free_posts = array_filter( $hits[0], ‘rlv_free_filter’ ); $other_posts = array_udiff( $hits[0], $free_posts, ‘rlv_id_comparison’……level of one post. There’s a function that will get all the posts on a particular level, though, so we need to come up with a method to get the list once, then use it to check each individual post. The relevanssi_hits_filter function is simple: it uses array_filter()to get the……target posts from the list of all search results, then array_udiff() to get the rest of the posts and then array_merge() to merge the list back together in the correct order. The filter function for array_filter() calls a function that will return a list of post IDs for the target…