我创建了一个自定义帖子类型“events”,以显示事件信息。登录后,所有指向事件的链接都能正常工作。然而,如果我没有登录,那么将来设置的事件的所有链接都会断开——有一条未找到页面的消息;但这些页面将在我登录后立即显示。-无论是否登录,过去事件的所有链接都运行良好。
请告知问题的原因和解决方法。
谢谢
我在函数中有以下代码。我的孩子主题中的php:
function enable_event_posttype() {
register_post_type( \'events\',
array(
\'labels\' => array(
\'name\' => __( \'Events\' ),
\'singular_name\' => __( \'Event\' ),
\'add_new\' => __( \'Add New Event\' ),
\'add_new_item\' => __( \'Add New Event\' ),
\'edit_item\' => __( \'Edit Event\' ),
\'new_item\' => __( \'Add New Event\' ),
\'view_item\' => __( \'View Event\' ),
\'search_items\' => __( \'Search Event\' ),
\'not_found\' => __( \'No events found\' ),
\'not_found_in_trash\' => __( \'No events found in trash\' )
),
\'public\' => true,
\'scheduled\' => true,
\'supports\' => array( \'title\', \'editor\', \'comments\'),
\'capability_type\' => \'post\',
\'rewrite\' => array("slug" => "events"), // Permalinks format
\'menu_icon\' => get_bloginfo(\'stylesheet_directory\') . \'/images/date.png\', // Icon Path
\'menu_position\' => \'5\'
)
);
}
add_action( \'init\', \'enable_event_posttype\' );