Hiding Posts on Front Page and from all plugins

admin2025-06-02  0

I’m using the following code to hide certain posts by post ID on the front page (as per / and on the WordPress Codex )

function exclude_single_posts_home($query) {
     if ($query->is_home() && $query->is_main_query()) {
          $query->set('post__not_in', array(69489, 69177,68878,68736));
      }
}

This code works well, but unfortunately I'm using a few other plugins on my main page (a most popular posts widget as well as flexslider to feature posts) and any posts that I hide will still show up in those plugins.

Is there a way to hide posts on the front page and also prevent it from being displayed on plugins on the same page?

I'm using Wordpress 5.0.3 and the theme Hueman.

Hope the question makes sense! Any help is greatly appreciated

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748834032a314108.html

最新回复(0)