problems exluding categories

Don’t use query_posts(). Filter pre_get_posts instead: function wpse65927_filter_pre_get_posts( $query ) { // If this is the blog posts index, // and if this is the main query, // exclude category 6 if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘cat’, ‘-6’ ); } } add_action( ‘pre_get_posts’, ‘wpse65927_filter_pre_get_posts’ ); Put the above hook and callback in … 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 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

Multiple arrays in post__not_in parameter

No, it doesn’t. You’d just merge the arrays: ‘post__not_in’ => array( array_merge( get_option( ‘sticky_posts’ ), array( 1, 2, 3 ) ), ) And just because someone else will mention it if I don’t: post__not_in has terrible performance and you’d be better off finding an alternate solution.

is there a quick way to hide category from everywhere?

pre_get_posts is the right hook for this since i just did category exclusion in another answer i will post it here too. Exclude the category from the WordPress loop based on the codex sample: http://codex.wordpress.org/Custom_Queries#Category_Exclusion add_action(‘pre_get_posts’, ‘wpa_31553’ ); function wpa_31553( $wp_query ) { //$wp_query is passed by reference. we don’t need to return anything. whatever … Read more

Exclude Tags from get_the_tags

<?php $how_many_posts = 50; $exclude_these_term_ids = array( 10, 20, 35, ); $args = array( ‘posts_per_page’ => $how_many_posts, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ); // get the last $how_many_posts, which we will loop over // and gather the tags of query_posts($args); // $temp_ids = array(); while (have_posts()) : the_post(); // get tags for each post … Read more