当我登录时,预定的帖子会显示

scheduled posts are showing when I am logged in

我有 posts,它们即将推出,但它们在网站上可见。因此,当我登录管理面板时,post 的单个页面没问题,但是当我在这种情况下注销时,它会重定向到错误 404 页面。有什么问题?我该如何解决?

找到解决方案,刚刚将其添加到我的 functions.php 中,以后的帖子显示在 single.php:

add_filter('the_posts', 'show_future_posts');
function show_future_posts($posts){
   global $wp_query, $wpdb;
   if(is_single() && $wp_query->post_count == 0)
   {
      $posts = $wpdb->get_results($wp_query->request);
   }
   return $posts;
}

试试这个 添加过滤器 the_post 过滤器

https://codex.wordpress.org/Plugin_API/Action_Reference/the_post