Articles of exclude

Filter keywords from search query

I have search over the google, somewhere out there and here(http://wordpress.stackexchange.com). But, i can’t seem to get the solution i was looking for. I would like to ask that, is there any solution which allows me to exclude the words i wanted to filter from search queries? Example: when visitors using my search box, they […]

Exclude post category in a blog page

I have two links in “news” where all the news posts goes “blog” where the rest goes just wanted to exclude the category “news” in the blog page I use the code $news = new WP_query (‘category_name =-news’) and it is not working Essentially, I want tell wordpress, I want all the posts to go […]

how can I use WP_Query to exclude a specific tag.?

I have the following working code for a query on a specific category and tag slug: $args = array( ‘category_name’ => $cat_name, ‘tag’ => $tag_name, ‘post__not_in’ => $sticky ); $my_query = new WP_Query( $args ); I can’t figure out how to exclude a specific tag name from the query. Do I need the tag ID? […]

How exclude 3 latest posts of a category in query_posts

I am newbie in wordpress development, and usually I use query posts with simple commands. I have a slider in home page which shows 3 latest posts form ‘featured’ category. I have also a news box category which shows 3 latest posts form ‘news’ category. for rest of my home page I want to show […]

wp_list_categories not excluing multiple ids

I recently updated to WP 4.4 and im using this code: $args = array( ‘orderby’ => ‘ID’, ‘show_count’ => 1, ‘taxonomy’ => ‘portfolio-type’, ‘use_desc_for_title’ => 1, ‘echo’ => 0, ‘title_li’ => ”, ‘exclude’ => ‘115,161’ ); wp_list_categories($args); it’s only excluding the first id 115, and ignoring other IDS, any solution for this?

how to get posts ids inside pre_get_posts filter?

I’m trying to do these one: On the home (front page) i have multiple posts loops. I need posts to not repeat across these loops ( i.e if post was shown in 1-st loop it should never appear in 2-nd or 3-rd and so on ). I’v come up with these ( lower ), but […]

Exclude current post from an array of posts?

I’m trying to exclude the current post from an array and I know that the codex says that it’s not possible to combine post__in and post__not_in in the same query… But in wordpress everything (well, almost…) is possible and I know that must be a way to exclude the current post from my posts array. […]

Exclude page from loop results

I am having difficulties excluding a specific page from my main index loop in my child theme. I have the following function found in functions.php that modifies my index.php loop so that it displays pages instead of posts: add_action( ‘pre_get_posts’, ‘pages_loop_on_index’ ); function pages_loop_on_index( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( […]

How can I exclude a specific ID from this line of code?

I am using this code to list pages with a specific letter at the beginning of them: $first_char = ‘H’; echo ‘<table class=”alphabet” style=”border:0px;border-color:transparent;”> <tbody><tr> <td width=”100px;” style=”border-color:transparent;”><span class=”separator-line”></span></td> <td style=”border-color:transparent;padding-left:5px;padding-right:5px;”><span class=”letter”><strong>’ . $first_char . ‘</strong></span></td> <td width=”100px;” style=”border-color:transparent;”><span class=”separator-line”></span></td> </tr> </tbody></table>’; $postids=$wpdb->get_col($wpdb->prepare(” SELECT ID FROM $wpdb->posts WHERE SUBSTR($wpdb->posts.post_title,1,1) = %s ORDER BY $wpdb->posts.post_title”,$first_char)); if […]

WP_Query Excluding pages with Order is 0

I have a custom WP_Query with the following arguments $args = array( ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’, ‘meta_key’ => ’tile-home’, ‘meta_value’ => 1, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’ ); That selects all the published pages which have the custom field tile-home set to 1 and orders them by the page attribute Order. How […]