Questions tagged [exclude]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
13 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 ...
0
votes
1answer
48 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 ...
0
votes
2answers
52 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 ...
1
vote
0answers
16 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 ...
0
votes
1answer
23 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 ...
0
votes
1answer
73 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 ...
0
votes
0answers
32 views

How to trigger different behavior in iFrame

I have a website in our company network from which I integrate content to other sites in our network via iframe. The source page can only be accessed with Login via SSO. However, I want to see that on ...
1
vote
2answers
61 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 = ...
0
votes
0answers
116 views

Exclude categories in WP REST API response through function

I want to exclude some categories from the API response but not using the argument exclude but through function: When using the default route: https://example.com/wp-json/wp/v2/categories I want to ...
0
votes
0answers
51 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? ...
0
votes
1answer
31 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 ...
0
votes
1answer
39 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 ...
0
votes
1answer
155 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 ...
0
votes
2answers
64 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()...
0
votes
1answer
212 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(...
0
votes
1answer
400 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=...
0
votes
1answer
21 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($...
0
votes
1answer
371 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 ...
0
votes
1answer
155 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( '...
0
votes
1answer
258 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 ...
1
vote
1answer
38 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 "$...
0
votes
0answers
66 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', '...
0
votes
1answer
102 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', '...
0
votes
1answer
150 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?
1
vote
1answer
19 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 ...
1
vote
1answer
212 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'); ...
0
votes
1answer
274 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 ...
1
vote
2answers
2k 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....
0
votes
1answer
277 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( '...
0
votes
1answer
27 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( '...
0
votes
3answers
439 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 ...
0
votes
1answer
814 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 ...
0
votes
2answers
1k 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 ...
0
votes
1answer
5k 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 ...
1
vote
0answers
20 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 ...
0
votes
0answers
53 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 ...
1
vote
1answer
975 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, ...
2
votes
1answer
128 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 ...
2
votes
1answer
153 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 ...
0
votes
2answers
1k 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? $...
1
vote
1answer
597 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, '...
0
votes
0answers
132 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 ...
0
votes
1answer
232 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' ...
1
vote
1answer
532 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 ...
1
vote
1answer
229 views

Exclude category from Tag Template

I'm trying to exclude a category from my tag template. Searching gives me nothing and kinda stuck. When I add the code below to my tag template it shows all posts... and I really would like to show ...
0
votes
1answer
127 views

How to exclude one category

This script I use to show articles from the same category in my single post, excluded the actual shown post...how can I exclude category 1 of this script so, that he further shows artikels from the ...
0
votes
0answers
32 views

How to exclude a category in the following Code?

I give out the Name of the category (in single post) with the following code: foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } If my postings ist in two ...
1
vote
1answer
122 views

Next Posts Prev Posts for Standard post format only

I am using the following functions in my single.php file to display links to Previous and Next posts: get_next_post(); get_previous_post(); I store them in 2 variables: $next_post = get_next_post();...
3
votes
5answers
2k views

wp_list_categories exclude not working

I'm try to exclude a specific category from a list of categories that a custom post has (in this case 'Uncategorized' - ID: 1). I've tried exclude: wp_list_categories([ 'include' => ...
0
votes
1answer
64 views

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;"> ...

1
2 3 4 5