specific post is not excluded from the loop

You’re just off by one letter it seems. post__not_in => array(118) Post & Page Parameters You can also try adding an if statement, such as: if($post->ID != 118) : … run rest of code Though not optimal, without seeing the rest of your template I can’t be certain. Additional Edit: <?php $loop = new WP_Query(array( … Read more

Don’t execute function on specific posts

This is a logic problem primarily, but your filter is faulty as well. Think carefully about that conditional. If any one of those values– $post->ID !== N— is true, the whole thing is true, and as a post can only have one ID for any post two of those conditions will be true. It won’t … Read more

Exclude categories by ID

You could try modifying your query such that you have an array of categories to exclude and a conditional in the foreach, working similarly to the !empty(). An untested example: <!– category list with thumbs –> <?php $terms = apply_filters( ‘taxonomy-images-get-terms’, ”, array(‘taxonomy’ => ‘category’) ); $exclude = array(1,7); //add the category IDs to exlcude … Read more

I need to exclude from a query a category and a few custom taxonomies

Change ‘relation’ => ‘OR’ to ‘relation’ => ‘AND’ to apply both exclusions to all posts returned. It may seem counterintuitive, but a post that satisfies one of the exclusions will be included even if it doesn’t satisfy the other. EDIT From the code linked in your comment below, this is the query being generated: SELECT … Read more

Exclude category from get_the_category

$cat_ids = wp_list_pluck( $cat, ‘term_id’ ); Once you get the category ids as you have mentioned above, you can search for the key having the category id 68 as $key = array_search(’68’, $cat_ids); Once you get the key, you can unset/remove that from the array as unset($cat_ids[$key]); Once that is removed, you can use the … Read more

Exclude some categories from the post page

Yes your code will fail, but not because the above answer, but because this isn’t the page you ask for. As you wrote, you set the page “videos” to be the page where all the posts are shown. When a page is set as a blogpage, WordPress will use home.php or index.php according to the … Read more

Exclude all subcategories in the_category (post)

There is no filter for the_category. All that the_category does is to echo get_the_category_list. Have a look at the function in wp-includes/category-template.php lines 273 – 275 273 function the_category( $separator=””, $parents=””, $post_id = false ) { 274 echo get_the_category_list( $separator, $parents, $post_id ); 275 } Personally I would say that the_category is incorrect for what … Read more

Exclude category from foreach loop

I believe you are using the following code from this pastebin link function posts_by_year() { // array to use for results $years = array(); // get posts from WP $posts = get_posts(array( ‘numberposts’ => -1, ‘orderby’ => ‘post_date’, ‘order’ => ‘ASC’, ‘post_type’ => ‘my-custom-post-type’, ‘post_status’ => ‘publish’ )); // loop through posts, populating $years arrays … Read more

How to exclude posts from category posts count

Assuming you have a list containing the post IDs you want to exclude, you could start with something like (PHP 7.3): function exclude_posts_from_category( array $cat_args ): array { $exclude = array(); // TODO Add post IDs to exclude. $cat_args[‘exclude’] = $exclude; return $cat_args; } add_filter( ‘widget_categories_args’, ‘exclude_posts_from_category’, 10, 1 ); You can read about the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)