Exclude posts in home slider from sections

I am assuming that you are saving the slider code in slider.php file, news section code in section-news.php file and following this kind of snippets in front-page/home/index .php file get_template_part(‘slider’); get_templates_part(‘section-news’); then you can edit the slider.php file and add the new array variable $do_not_duplicate. So it is preserving the slider post IDs for future … Read more

Why do I have categories with duplicate slugs?

Just to note: There will not be a delete option on a category on the Category page if posts are assigned to that category. (Added see below.) If you want to delete a category, you have to first change those posts to another category. You can do this on the Posts page, sort by category, … Read more

How to remove a post from results by ID after query?

Perhaps something like this would work? // Assuming $posts = new WP_Query( $args ); $post_to_remove = 123; // If using post objects foreach ( $posts->posts as $i => $post ) { if ( $post_to_remove == $post->ID ) { unset( $posts->posts[$i] ); break; // no need to continue the loop as the post has been found … Read more