我无法阻止我的自定义帖子类型,从零星404。
它并不总是发生,我也无法预料地复制这个问题--就像有时发生,有时不发生一样。然而,一旦我清除缓存,404就会消失,URL就会正常工作。
我已经尝试重置和重新保存permalinks,这是目前的类别/后置名称。
我还试着玩刷新重写规则,将它们设置为空白和错误,但似乎没有任何东西可以解决这个问题。
以下是我的当前代码:
add_action('init', 'create_raceresults_post_type');
function create_raceresults_post_type() {
register_post_type('raceresults', array(
'labels' => array(
'name' => 'Race Results',
'singular_name' => 'Race Results',
'add_new' => 'Add New Race Result',
'add_new_item' => 'Add New Race Result',
'edit' => 'Edit Race Result',
'edit_item' => 'Edit Race Result',
'new_item' => 'New Race Result',
'view_item' => 'View Race Result',
'search_items' => 'Search Race Result',
'not_found' => 'No Race Result found',
'not_found_in_trash' => 'No Race Result found in Trash'
),
'public' => true,
'exclude_from_search'=> false,
'rewrite' => array('slug' => 'best-running-training-program', 'with_front' => true),
'supports' => array(
'title',
'excerpt',
'title',
'excerpt',
'editor',
'custom-fields',
'revisions',
'thumbnail',
'author',
'page-attributes'
),
'taxonomies' => array('category', 'post_tag') // this is IMPORTANT
));
flush_rewrite_rules();
} 有什么东西我错过了还是没有尝试?下面是自定义帖子的一个示例:http://runnersconnect.net/best-running-training-program/race-results-march-24-march-25/。我刚试过,它在我60分钟前第一次发表的时候起了作用,但是当我试着检查它的时候,只有404次。
提前感谢!
发布于 2012-03-30 13:30:23
由于您是由WPEngine托管的,我建议您直接与他们联系并征求意见。可能因为某种原因,你的CPT无法可靠地进入他们的缓存,但是他们可以给你一个比我们任何一个人更好的答案。
你一定要把你已经提交的票升级。如果这是一个断断续续的问题,似乎解决了当您重置缓存,那么它是直接相关的缓存。我知道WPEngine使用了一些非标准代码.所以我们在这帮不了什么忙
https://wordpress.stackexchange.com/questions/46927
复制相似问题