Get post related to current post

From what i understand of your question, you are trying to do a meta query. You can do this by the following arguments: $args = array( ‘posts_per_page’ => 10, ‘post_type’ => ‘mobile’, ‘meta_query’ => array( array( ‘key’ => ‘select2_posts’, ‘compare’ => ‘LIKE’, ‘value’ => $value_here ) ) ); You can read more about meta queries … Read more

Merge two queries and remove duplicate

Why not do something like this? $fav_author_list = get_user_option( ‘favorite-authors’, fav_authors_get_user_id() ); $fav_category_list = get_user_option( ‘favorite-categories’, fav_categories_get_user_id() ); if(!empty($fav_author_list) && !empty($fav_category_list)) { $rm_args = array( ‘posts_per_page’ => -1, ‘author__in’=> $fav_author_list, ‘category__in’=> $fav_category_list, ‘post_type’ => ‘post’ ); } elseif(!empty($fav_author_list) && empty($fav_category_list)) { $rm_args = array( ‘posts_per_page’ => -1, ‘author__in’=> $fav_author_list, ‘post_type’ => ‘post’ ); } elseif(empty($fav_author_list) … Read more

Related Post by Tags Code

So, if I’m reading your code correctly, you are trying to dump all the current posts’ tag IDs into your tag__in array. My only hesitation is I’m not sure exactly how the query returns the order, if it’s just done by post date or actual tag relevance. That should look something like this: if ( … Read more