Articles of exclude

How to filter by category in REST API, excluding posts also in other category term?

I’m using REST API to load a several posts from other site, each post must belong to a different category. However I have one “Featured events” category, that includes posts also shown in other category, so I have a post repeated in two different categories. My query for the featured category is like this: http://localhost/wp-json/wp/v2/events/?categories=23&per_page=1 […]

Do not allow to search certain words

I would like to delete (not allow) searches with certain keywords (eg “of”, “a”). If the search is done using exactly these terms, do not return anything or redirect to 404 page … Thanks guys.

Exclude Category From Home Page, Display Posts on It's Own Page?

I created a new category with the ID of 57, how do I exclude this category from the homepage/blog and then list the posts from this category on its own page? this is what my index.php looks like <?php $popular_count = 1; query_posts( array( ‘orderby’ => ‘comment_count’,’posts_per_page’ => 6 ) ); if ( have_posts() ) […]

How to exclude posts from a category when using this particular format

I’m trying to exclude posts from a certain category from being displayed on my home.php. The code that is in my theme is as follows: query_posts(array(‘post__not_in’ => $featured_posts_array)); if (have_posts()) : while (have_posts()) : the_post(); ?> <div <?php post_class() ?> id=”post-<?php the_ID(); ?>”> <div class=”categories”> <h3><?php the_categories_excerpt(); ?></h3> I tried adding the following before the […]

Exclude specific taxonomy term when using wp_get_post_terms

i have a single-post_type.php file where i constructud a breadcrumb (or similer to) i am currently using this to get the terms of this taxonomy: $terms = wp_get_post_terms( $post->ID, ‘wedding_cat’); . Later on i am showing that term like this: <div class=”breadcrumbs”><?php $term = array_pop($terms); echo ‘<a href=”‘. get_bloginfo(‘url’) .'”>’. __(‘Home’, ‘sagive’) . ‘</a> &raquo; […]

How do I exclude posts by custom field value?

I need to exclude posts that have a custom field ‘city’ value of ‘Melbourne’. After much searching I think the solution might consist of 2 parts. In functions.php : A function to get the post IDs for all posts which have a custom field ‘city’ value of ‘Melbourne’. Then in my loop : Exclude these […]

Exclude custom taxonomy tag from loop

I have the following code at the beginning of a loop: <?php query_posts(‘showposts=3&cat=84’); ?> <?php $posts = get_posts(‘category=84&numberposts=3&offset=0’); foreach ($posts as $post) : start_wp(); ?> I have a custom taxonomy called “display,” with a tag called “featured-slider.” In this loop, I want to include everything from category 84, but I want to exclude everything with […]

is there a quick way to hide category from everywhere?

I want to get rid of some posts, old ones, that I don’t really want to keep. I was thinking to create a category named ‘old’ and use it as a garbage can to trash everything I don’t like from old posts. Reason I don’t simply delete them is the google traffic. Some of those […]

exclude custom post type by meta key in wp_query

I’m trying to display a custom post type (properties) and exclude posts that have a certain meta value (sold). Is there a way that I can do this? I have this for my code so far: $args = array( ‘post_type’ => ‘property’, ‘orderby’ => ‘meta_value’, ‘meta_key’ => ‘random_775’, ‘order’ => ‘ASC’, ‘posts_per_page’ => 100, ); […]

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’ => wp_list_pluck(get_the_category(), ‘term_id’), ‘title_li’ => ”, ‘exclude’ => 1 ]); But it still appears. How can I make sure it never appears, even if a post […]