Questions tagged [exclude]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
49 views

Exclude a category ID from the following function

I've used a query that will query if the post in a specific category, to show a list of subcategories it belongs to. The problem I'm having is I also want to exclude a specific subcategory from the ...
Emma's user avatar
  • 11
0 votes
0 answers
23 views

How to exclude first 2 posts from a specific category for a custom post type archive page

I have a custom post type, product with various categories. On the archive page for this post type, I would like to exclude the first 2 posts tagged with the "Featured" category (ID 7) from ...
SleeplessInSublime's user avatar
0 votes
0 answers
81 views

WP Recommended Table Exclusions?

I just re-designed my WP work flow to utilize 2 bash scripts (push.sh & pull.sh) that I wrote that will push/pull my files with git, upload/download & import/export my dbs using rsync and wp-...
mjones's user avatar
  • 153
0 votes
0 answers
124 views

excluding posts by an ACF field in pagination

So I have this $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'post', 'posts_per_page' => 12, 'category' => 1165, 'meta_query' =&...
MikeKJ's user avatar
  • 1
0 votes
1 answer
346 views

Exclude Custom post type from /blog page

Custom post type name is "project". I need code in functions.php This is working for search: // Exclude custom post type from WP Search add_action( 'init', 'update_my_custom_type', 99 ); ...
Branko Todorović's user avatar
0 votes
1 answer
319 views

Exclude a specific post in a Custom Post Type

I have a very simple query to display all my posts in a custom post type: <?php $page = get_page_by_title('Duck'); $args = array( 'post_type' => 'sessions', 'post__not_in'...
Josh Rodgers's user avatar
  • 1,173
2 votes
1 answer
833 views

How to exclude a directory from WordPress permalinks in a Multisite environment?

The scenario is as follows: A multisite install with three sites: site1.com (admin) site2.com site3.com Q: How to exclude a folder located in the root directory, which should also be associated with ...
Nils's user avatar
  • 43
1 vote
1 answer
24 views

Exclude a category from the filed under list only on some templates

this is a follow up question to this post Exclude a category from the filed under list The solution given works for me. However, I'm curious how I can get this to work conditionally? Specifically, ...
joycegrace's user avatar
0 votes
1 answer
659 views

How to exclude posts that already appear in the main loop, from the category loop

In my front-page I have 2 loops: the first one is for latest 20 posts in all categories the second one is for latest 6 posts in one specific category How can I remove from the second loop (specific ...
Antonino Lattene's user avatar
0 votes
1 answer
615 views

How to get an array of pages ID by some page's slug and all its children pages in get_posts() function?

I have a custom function in my theme that creates a dynamic sitemap.xml file. For that I'm using $myVar = get_posts( array(...) ). In that array I need to exclude some pages. I want to exclude some ...
Victor's user avatar
  • 25
0 votes
2 answers
956 views

How to remove an item from a custom Walker_Nav_Menu

I have a custom menu on a wordpress + woocommerce site using the Walker_Nav_Menu class. When hiding posts (products) from the site those posts and category are still included in the custom menu. I ...
MarvynH's user avatar
1 vote
0 answers
48 views

How do I exclude recent post from recent post php widget

I have this code, and I tried adding in post__not_in as suggested by another post I found on this website, and it didn't break anything but didn't work either. I also tried different examples. Here's ...
sevenkader's user avatar
0 votes
1 answer
288 views

Exclude a category and post_type from wp_query

I'm trying to figure out a simple way to exclude a particular category from a wp_query on my homepage. this particular code is already excluding a post_type (videos) from displaying, and I'm not ...
Dave's user avatar
  • 1
0 votes
1 answer
460 views

wp_list_pages() exclude category

I tried adding this to a similar much older thread but didn't get a response so I am posting it as a new question. I have a large page based website that I am working on. Since it is mainly page ...
Phil's user avatar
  • 3
1 vote
2 answers
516 views

WordPress category widget only show categories with children

I'm trying to modify the inbuilt WordPress category widget to only show categories if they have children. I was using this code: function exclude_widget_subcategories($args){ $all_categories = ...
fionchadd's user avatar
0 votes
0 answers
73 views

Exclude Specific Product Category for showing up in its parent category page

I am displaying a list of product sub-categories in a grid format in the parent Categories. There is a specific category with id 7000 which I want to exclude from the grid. How do I accomplish this? ...
Kevin S's user avatar
  • 37
0 votes
1 answer
39 views

Only Show Excerpt After First 3 Posts

I'm using the template part below and would like to only show the excerpt after the first 3 posts. The first 3 posts are formatted differently as "header" posts and thus I'd rather not have an excerpt ...
Tnace's user avatar
  • 17
0 votes
1 answer
54 views

Normal PHP array for exclude section of WordPress query?

I just wanted to check on something with the community here and avoid any future drama. I have a variable which seems to be working fine in a wp_user_query but not sure if I'm missing something that ...
Neil's user avatar
  • 34
0 votes
1 answer
480 views

Sort populated GravityForms list alphabetically [closed]

hope someone can help a newbie because I'm stumped on how to do this. I've got the following code in my functions.php that populates a GravityForms form "checkbox list" of products. The user selects ...
app.licious Group Pty Ltd's user avatar
0 votes
2 answers
186 views

Skip latest 3 posts from loop

I downloaded a starter theme (Underscores). I want to exclude first 3 post from my loop on index page. Here is the loop; <?php if ( have_posts() ) : if ( is_home() && ! is_front_page()...
Kerem Beyazit's user avatar
0 votes
1 answer
436 views

Create a list of pages excluding children of selected page

I am looking to find a way to create a list of the IDs of children pages from a selected page. My goal is to use the list of IDs so that I can exclude them from the following function: wp_list_pages(...
Peter's user avatar
  • 1
0 votes
1 answer
887 views

Exclude category and post from loop in custom category.php

So I created a custom category.php where I have the following loop: <div id="category__product-grid" class="row"> <?php // The Loop while ( have_posts() ) : the_post(); ?> <div class=...
Jamdev's user avatar
  • 117
0 votes
1 answer
33 views

How can I exclude a particular category from my Wordpress Page 1 and Page 2?

I have 2 pages in the Wordpress site. All 2 pages are showing posts. I need to restrict few categories in First Page and other few categories from Second Page. <?php function excludeCat($...
Sajeev's user avatar
  • 101
0 votes
1 answer
609 views

Exclude first image from a Woocommerce image gallery

I would like to exclude the first image from the image gallery (this is not the featured image of the product) of a single product page in Woocommerce. I'm not an expert on PHP but, could an ...
Joel Knox's user avatar
0 votes
1 answer
443 views

Multiple arrays in post__not_in parameter

Does the post__not_in parameter can have multiple arrays for excluding, for example, sticky posts and also the IDs of some other posts? Something like: 'post__not_in' => array( get_option( '...
Vasili's user avatar
  • 25
0 votes
1 answer
635 views

Excluding category from post navigation in Wordpress?

I'm looking to exclude a category from the post navigation. Originally, I looked up manipulating <?php the_post_navigation(); ?> to exclude categories, but a few posts I read (like this) pointed ...
Brittany Layne Rapheal's user avatar
1 vote
1 answer
228 views

Remove ID page from wp_count

I'm try to create a pages counter excluding certain ID pages but the code don't work. I'm using this code. How can I fix it? Thanks. <?php $count_pages = wp_count_posts('page'); echo "$...
PhineasD's user avatar
0 votes
0 answers
205 views

post__in and tag__not_in conflict

I have related post section in my theme. I would like to exclude posts from a certain tag. This is my query: 'post__in' => $related_posts_ids, 'orderby' => 'post__in', '...
ahmet's user avatar
  • 41
0 votes
1 answer
149 views

Exclude Category ID in function

I have the following code appending an ad block at the end of my posts function info_after_post($content){ if (is_single()) { $content .= 'AD CODE'; } return $content; } add_filter( 'the_content', '...
Goob's user avatar
  • 1
0 votes
1 answer
307 views

How to list all tags except the current tag in tag.php

I'm struggling to find a way to list all my tags without the current tag showing when i'm on a tag.php page. All I have is this, but it's not the current tag?
Pete's user avatar
  • 998
1 vote
1 answer
23 views

is there a way to retrieve posts that do not have a featured image assigned?

so as the questions states, what im trying to accomplish is to fetch only the posts that do not have a featured image set. i tried looking through the docs and i noticed you can use the - symbol to ...
jordan's user avatar
  • 139
1 vote
1 answer
294 views

Combine get_page_by_title to exclude pages from wp_list_pages

I am using get_page_by_title to exclude a few pages from wp_list_pages, my code looks like: <?php $page1 = get_page_by_title('title1'); $page2 = get_page_by_title('title2'); ...
Josh Rodgers's user avatar
  • 1,173
0 votes
1 answer
507 views

Multiple Taxonomy post query with exclusion

I have multiple taxonomies for a custom post type ('product') and I would like people to select from the list whether they want to include one or more of the terms and if they want to exclude one or ...
Kaye O'Malley's user avatar
2 votes
2 answers
3k views

Exclude subfolder from WP-redirect works with html but not php files

I want a certain subfolder excluded from being handled by WP with its 404 - page not found message. My problem is: example.com/Non_WP/myfile.html - shows correctly but example.com/Non_WP/myfile....
Raphael's user avatar
  • 31
1 vote
1 answer
766 views

Exclude Specific Tag On Homepage

I'd like to exclude Tag ID: 26 from my homepage. I've figured out how to do it with categories, but not with tags. function exclude_posts( $query ) { if ( $query->is_home ) { $query->set( '...
Kareem Sayeed's user avatar
0 votes
1 answer
33 views

Combine "Exclude" Query in functions.php

I was wonder if I can combine these two pieces of code together? function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( '...
Kareem Sayeed's user avatar
0 votes
3 answers
809 views

Excluding posts not working

I have tried a lot but didn't got a proper result. Someone please check my code, where I am doing mistake. I want to show other posts with same categories but not the post shows on single page also ...
Satrughna Sethy's user avatar
0 votes
1 answer
1k views

Exclude pages with certain template from wp_list_pages

Before you mark this as duplicate I have tried every method in all the other questions and non of them have worked. I am trying to exclude any page with the page template page-noindex.php from the ...
Daniel Vickers's user avatar
0 votes
2 answers
2k views

Include posts from some categories while excluding from others

I cannot successfully filter posts from some categories and exclude at the same time from others. The code is working perfectly when used to include only posts from a given category. Categories to be ...
Riccardo's user avatar
  • 931
0 votes
1 answer
8k views

Exclude category from WP_Query args not working

Everything else in these args works great. The only thing that isn't working is the exclusion of the uncategorized category. I've tried both 'cat' => '-1', where 1 is the ID of the uncategorized ...
dmoz's user avatar
  • 166
1 vote
0 answers
23 views

Individual post. Meta_key, taxonomy or post status for separation?

I have a posts with custom type - TOUR. Among ordinary Tours sometimes I need to create "personal" or "private" Tour, which will be shown only to assigned user. What the way is better to exclude this ...
Karin Kador's user avatar
0 votes
0 answers
57 views

Displaying Category in sidebar post widget but not in the loop on home

I've seen many pages on how to exclude a category from the home page entirely. I am setting up a site to have a widget called News that displays the latest news items on the right but it seems like ...
kylebellamy's user avatar
1 vote
1 answer
2k views

I need to create a search form that will display search results from specific category

I'm trying to create a custom search box that will show posts from specific category by my choise. Every term that will be submitted in the search box will apply the search in one category data, ...
Shay S's user avatar
  • 69
2 votes
1 answer
347 views

How to exclude shortcode from specific page IDs if it's set to global

At this moment I am using the code below, to add a shortcode for a table on all the posts and pages, but I would like to exclude few pages and any post with a specific tag. (ex. page ids 10,20 and tag ...
Archi25's user avatar
  • 33
3 votes
1 answer
601 views

Filter Posts by Excluding Categories

I am logged on as admin I am on the Posts dashboard I have Posts assigned to multiple Categories and I have posts that are assigned to only one category. I want to display posts that are assigned ...
Joseph Butler's user avatar
0 votes
4 answers
2k views

List child pages, exclude the current page

I'm trying to display the child pages of a parent page, this is working. But when I tried to exclude the current page in the list where the child pages displayed, it's not working. How to fix this? $...
user103182's user avatar
1 vote
1 answer
826 views

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, '...
MKay's user avatar
  • 179
0 votes
0 answers
152 views

Exclude Posts from a Widget

I downloaded a widget that would display the most popular/most visited pages, but unfortunately the widget didn't come with an 'Exclude Posts' field, which would be really useful to me. So for the ...
Trenton Moore's user avatar
0 votes
1 answer
316 views

Woocommerce filter function not updating

I have a simple function to exclude a few categories from my Woocommerce shop page. This is the following code: add_filter( 'woocommerce_product_categories_widget_args', 'woo_product_cat_widget_args' ...
Mr Riksson's user avatar
1 vote
1 answer
978 views

Excluding pages in WP_query using ACF

I have a custom loop for showing child pages of the current page, but I'd like to allow the WP user to enter page IDs to be excluded from the loop, using Advanced Custom Fields. My current loop is as ...
Cintia's user avatar
  • 39

1
2 3 4 5