首先也是最重要的一点,这无疑是“我的Wordpress永久链接正在生成404个错误”这一古老问题的重复,但在某种程度上,这是不同的,因为我尝试过的任何解决方案都不起作用。
A little back-story to my problem:
我在当地开发了一个Wordpress网站,所有的permalinks和一切都很有效。我在服务器上安装了Wordpress的新副本,导入了我所有的本地帖子,主页上的一切看起来都很棒,这就是伟大的终结。permalinks都不起作用,页面、帖子(所有帖子都使用自定义帖子类型),它们都给了我这样的信息:
"Not Found
The requested URL /content/we-need-to-talk-about-kevin/ was not found on this server."
这篇文章所属的帖子类型称为:“sketcphad”,但是我在register\\u post\\u type函数上有一个重写,使其成为“content”,它肯定在本地工作,所以这不是问题所在。
Things that I have tried:
<手动更换。htaccess rewrite rules,然后将其删除,然后再次将其添加到我的函数中。php文件访问设置->永久链接页面,然后单击保存,尝试另一个永久链接结构(当前为/%postname%),我尝试了其他一些结构,但没有成功
尝试删除内容并手动重新添加尝试手动重新添加页面,我的服务器上发生了什么导致这些问题?服务器运行的LAMP环境基本相同,但我的本地LAMP环境在Windows上使用XAMPP,但我已将许多站点从本地移动到远程服务器,没有出现类似问题。我没看到什么?
See below for my functions.php code that registers the post types.
function sketchpad_posttype()
{
// Labels for our custom post type
$labels = array(
\'name\' => _x(\'Content\', \'sketchpad\'),
\'singular_name\' => _x(\'Content Entry\', \'sketchpad\'),
\'add_new\' => _x(\'Add New\', \'Content Entry\'),
\'add_new_item\' => __(\'Add Content Entry\'),
\'edit_item\' => __(\'Edit Content Entry\'),
\'new_item\' => __(\'New Content Entry\'),
\'view_item\' => __(\'View Content Entry\'),
\'search_items\' => __(\'Search Content Entries\'),
\'not_found\' => __(\'Nothing found\'),
\'not_found_in_trash\' => __(\'Nothing found in Trash\'),
\'parent_item_colon\' => \'\'
);
// Arguments that specify how we use our custom post type
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'publicly_queryable\' => true,
\'show_ui\' => true,
\'query_var\' => true,
\'menu_icon\' => get_stylesheet_directory_uri() . \'/images/icons/notepad.png\',
\'rewrite\' => array(\'slug\' => \'content\'),
\'capability_type\' => \'post\',
\'hierarchical\' => false,
\'menu_position\' => null,
\'supports\' => array(\'title\',\'editor\', \'thumbnail\'),
\'taxonomy\' => array(\'category\')
);
// Call the register_post_type function and make it official
register_post_type( \'sketchpad\' , $args );
}
function article_posttype()
{
// Labels for our custom post type
$labels = array(
\'name\' => _x(\'Articles\', \'article\'),
\'singular_name\' => _x(\'Article\', \'article\'),
\'add_new\' => _x(\'Add New\', \'Article\'),
\'add_new_item\' => __(\'Add Article\'),
\'edit_item\' => __(\'Edit Article\'),
\'new_item\' => __(\'New Article\'),
\'view_item\' => __(\'View Article\'),
\'search_items\' => __(\'Search Articles\'),
\'not_found\' => __(\'Nothing found\'),
\'not_found_in_trash\' => __(\'Nothing found in Trash\'),
\'parent_item_colon\' => \'\'
);
// Arguments that specify how we use our custom post type
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'publicly_queryable\' => true,
\'show_ui\' => true,
\'query_var\' => true,
\'menu_icon\' => get_stylesheet_directory_uri() . \'/images/icons/notepad.png\',
\'rewrite\' => array(\'slug\' => \'article\'),
\'capability_type\' => \'post\',
\'hierarchical\' => false,
\'menu_position\' => null,
\'supports\' => array(\'title\',\'editor\',\'thumbnail\'),
\'taxonomy\' => array(\'category\')
);
// Call the register_post_type function and make it official
register_post_type( \'article\' , $args );
}
// Register our custom post types
add_action(\'init\', \'sketchpad_posttype\');
add_action(\'init\', \'article_posttype\');