迁移后未显示内容的帖子

时间:2019-05-14 作者:Byte IT Antwerpen

我最近向wordpress转移了一个约10万篇文章的庞大自定义数据库。一切似乎都正常。但最近在查看网站时。我发现这个问题,帖子显示在哪里,但单击后,它不会打开。不知何故,该链接不包含帖子标题。虽然当我编辑并更新帖子时,它是有效的。现在的问题是,每次批量更新100篇帖子非常耗时。还有别的办法吗?

我试图更新永久链接设置,但没有用。

我们将非常感谢您的帮助。

1 个回复
最合适的回答,由SO网友:Byte IT Antwerpen 整理而成

根据建议Jos 原因是post_name 中的列wp_posts 表为空。为纠正上述问题,采取了以下步骤:

备份数据库select * from (select count(*) as c, post_title from wp_posts where post_name = \'\' and post_type = \'post\') as counts where c > 1;wp_posts set post_name = replace(post_title, \' \', \'-\');post_name 列不包含重音字符或URL中不允许的字符post_name 通过运行以下查询(sql中的绝对noob):

UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Š\',\'S\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'š\',\'s\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ð\',\'Dj\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ž\',\'Z\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ž\',\'z\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'À\',\'A\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Á\',\'A\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Â\',\'A\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ã\',\'A\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ä\',\'A\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Å\',\'A\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Æ\',\'A\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ç\',\'C\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'È\',\'E\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'É\',\'E\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ê\',\'E\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ë\',\'E\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ì\',\'I\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Í\',\'I\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Î\',\'I\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ï\',\'I\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ñ\',\'N\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ò\',\'O\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ó\',\'O\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ô\',\'O\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Õ\',\'O\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ö\',\'O\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ø\',\'O\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ù\',\'U\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ú\',\'U\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Û\',\'U\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ü\',\'U\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ý\',\'Y\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Þ\',\'B\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ß\',\'Ss\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'à\',\'a\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'á\',\'a\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'â\',\'a\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ã\',\'a\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ä\',\'a\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'å\',\'a\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'æ\',\'a\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ç\',\'c\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'è\',\'e\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'é\',\'e\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ê\',\'e\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ë\',\'e\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ì\',\'i\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'í\',\'i\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'î\',\'i\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ï\',\'i\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ð\',\'o\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ñ\',\'n\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ò\',\'o\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ó\',\'o\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ô\',\'o\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'õ\',\'o\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ö\',\'o\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ø\',\'o\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ù\',\'u\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ú\',\'u\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'û\',\'u\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ý\',\'y\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ý\',\'y\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'þ\',\'b\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ÿ\',\'y\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ƒ\',\'f\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'.\',\'-\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'-\',\'-\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'--\',\'-\');

UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ě\',\'e\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ž\',\'z\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'š\',\'s\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'č\',\'c\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ř\',\'r\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ď\',\'d\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ť\',\'t\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ň\',\'n\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'ů\',\'u\');

UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ě\',\'E\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ž\',\'Z\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Š\',\'S\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Č\',\'C\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ř\',\'R\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ď\',\'D\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ť\',\'T\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ň\',\'N\');
UPDATE `wp_posts` SET post_name = REPLACE(post_name,\'Ů\',\'U\');
UPDATE `wp_posts` SET
    post_name = lower(name),
    post_name = replace(post_name, \'.\', \'-\'),
    post_name = replace(post_name, \',\', \'-\'),
    post_name = replace(post_name, \';\', \'-\'),
    post_name = replace(post_name, \':\', \'-\'),
    post_name = replace(post_name, \'?\', \'-\'),
    post_name = replace(post_name, \'%\', \'-\'),
    post_name = replace(post_name, \'&\', \'-\'),
    post_name = replace(post_name, \'#\', \'-\'),
    post_name = replace(post_name, \'*\', \'-\'),
    post_name = replace(post_name, \'!\', \'-\'),
    post_name = replace(post_name, \'_\', \'-\'),
    post_name = replace(post_name, \'@\', \'-\'),
    post_name = replace(post_name, \'+\', \'-\'),
    post_name = replace(post_name, \'(\', \'-\'),
    post_name = replace(post_name, \')\', \'-\'),
    post_name = replace(post_name, \'[\', \'-\'),
    post_name = replace(post_name, \']\', \'-\'),
    post_name = replace(post_name, \'/\', \'-\'),
    post_name = replace(post_name, \'-\', \'-\'),
    post_name = replace(post_name, \'\\\'\', \'\'),
    post_name = trim(post_name),
    post_name = replace(post_name, \'-\', \'-\'),
    post_name = replace(post_name, \'--\', \'-\');

UPDATE `wp_posts` SET post_name = LOWER(post_name);
<似乎一切都正常Rebuild Permalinks\' 只是想确定一下

相关推荐

返回LOAD_POSTS_BY_AJAX中的条件类别

我创建了一个返回最后三篇文章的短代码,并设置了一个属性,允许我根据所处的页面选择类别。function return_actu_home($atts) { ob_start(); extract( shortcode_atts( array( \'category\' => \'\' ), $atts ) ); $args = array( \'post_type\' =>