Questions tagged [exclude]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
12 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-...
  • 145
0 votes
0 answers
15 views

exclude certain categories form archive widget

i need some help for this...i want to hide posts of one specific category from appearing in the (sidebar-)archive-widget (chronological order, dropdown). I already tried to use the "ultimate ...
0 votes
0 answers
25 views

Exclude Woocommerce Product Category From Sitemap

Am trying to exclude 2 specific product categories from default WordPress sitemap. Any help how to archive this? add_filter( 'wp_sitemaps_posts_query_args', function( $args, $post_type ) { if ( ...
  • 35
0 votes
0 answers
21 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' =&...
  • 1
0 votes
0 answers
26 views

Hide/exclude certain tags under single post

I'm using the 'featured' tag to show certain posts on my homepage. But under the single post it also shows the featured tag, next to my real tags. How do I hide this with code? I've looked at similar ...
  • 1
0 votes
1 answer
89 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 ); ...
0 votes
1 answer
192 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'...
  • 1,113
2 votes
1 answer
468 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 ...
  • 43
1 vote
1 answer
23 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, ...
0 votes
1 answer
149 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
1 answer
357 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 ...
  • 25
0 votes
2 answers
633 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
0 answers
37 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
1 answer
84 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 ...
  • 1
0 votes
1 answer
369 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 ...
  • 3
1 vote
2 answers
383 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
0 answers
60 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? ...
  • 37
0 votes
1 answer
36 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 ...
  • 17
0 votes
1 answer
47 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 ...
  • 34
0 votes
1 answer
346 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
2 answers
132 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
1 answer
350 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(...
  • 1
0 votes
1 answer
793 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=...
  • 117
0 votes
1 answer
32 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($...
  • 101
0 votes
1 answer
570 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
1 answer
356 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( '...
  • 25
0 votes
1 answer
505 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
1 answer
194 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
0 answers
157 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', '...
  • 33
0 votes
1 answer
139 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', '...
  • 1
0 votes
1 answer
254 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?
  • 976
1 vote
1 answer
22 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 ...
  • 39
1 vote
1 answer
268 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'); ...
  • 1,113
0 votes
1 answer
432 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 ...
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....
  • 31
1 vote
1 answer
586 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
1 answer
32 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
3 answers
740 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
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 ...
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 ...
  • 893
0 votes
1 answer
7k 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 ...
  • 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 ...
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 ...
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, ...
  • 49
2 votes
1 answer
299 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 ...
  • 33
2 votes
1 answer
533 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
4 answers
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
1 answer
753 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, '...
  • 165
0 votes
0 answers
149 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
1 answer
282 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
2 3 4 5