允许任何人在Wordpress中查看特定帖子类型(事件)的将来帖子 [英] Allow anyone to view future posts of a certain post type (events) in Wordpress

查看:88
本文介绍了允许任何人在Wordpress中查看特定帖子类型(事件)的将来帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Wordpress上有一个系统,其中的事件是排定的帖子,循环中的单词很棒.

I have had a system on Wordpress where events are scheduled posts and word great in loops.

但是,我只是注意到,单击事件并转到其页面时,它会显示404.我可以在登录时预览它,但是,即使当前正在使用它,任何人都必须可以看到它预定的.

However I just noticed that when clicking on an event and going to it's page, it gives a 404. I can preview it when I'm logged in, however, I need to it to be visible by anyone even though it's currently scheduled.

是否可以更改权限,以便任何人都可以查看特定的预定帖子类型?

Is there a way to change permissions so that anyone can view a specific scheduled post type?

谢谢!

推荐答案

将来的帖子有点Catch-22:您可以在任何老式的Wordpress Loop中查询它们,但直接导航到 is不可能 .....,至少在标准的Wordpress范围内:

Future posts are a bit of a Catch-22: You can query them in any good old-fashioned Wordpress Loop, but navigating to them directly is not possible..... at least, within the standard Wordpress Scope:

<?php
$q = new WP_Query(array('post_status'=>'future'));
if($q->have_posts()) : while($q->have_posts()) : $q->the_post;
    echo '<a href="'.get_permalink().'">'.get_the_title().'</a>'; //404 when clicked
endwhile;endif;
?>

这样做的原因不是由于权限.这是因为它是在Wordpress Core中构建的.将来的帖子不打算在特定日期之前显示.试图使将来的帖子可供查看是对未来"状态的滥用,并且无法达到其全部目的,即计划在到达指定日期后将帖子或页面自动切换为已发布"状态.

The reason for this is not because of permissions. It's because that's how it's built in the Wordpress Core. Future Posts are not intended to be viewable until a specific date. Trying to make future posts available for viewing is a misuse of the 'future' status and defeats its whole purpose which is to schedule a post or a page to automatically switch to a status of 'Published' when the designated date has been reached.

但是,如果您仍然希望像普通帖子一样提供未来帖子",请

If, however, you still want to make Future Posts available as if they're normal posts, This discussion can probably shed some light on various methods and plugins to make everything happen the way you want.

祝你好运.

这篇关于允许任何人在Wordpress中查看特定帖子类型(事件)的将来帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆