当你的WordPress文章发布以后,再次修改别名(slug),WordPress会自动重定向到新的别名(使用301重定向),这是非常棒的。但是它依旧会在数据库中使用 _wp_old_slug 这个键保存旧的文章别名。
下图的 mp6-bootstrap-admin 就是该文章的别名:

如果你想删除它,可以登录 phpMyAdmin ,然后使用下面的 SQL 命令:
注意:数据库操作有风险,请记得先备份数据库!!
删除某篇文章的旧别名:
DELETE FROM `wp_postmeta` WHERE `meta_key` = '_wp_old_slug' AND `meta_value` = 'the-old-post-slug' |
DELETE FROM `wp_postmeta` WHERE `meta_key` = '_wp_old_slug' AND `meta_value` = 'the-old-post-slug'
删除所有文章的旧别名:
DELETE FROM `wp_postmeta` WHERE `meta_key` = '_wp_old_slug' |
DELETE FROM `wp_postmeta` WHERE `meta_key` = '_wp_old_slug'
注意修改 wp_postmeta 的前缀 wp_ 为你的数据库前缀。
推荐阅读:
phpMyAdmin教程 之 使用SQL查询语句修改数据库信息
WordPress 常用数据库SQL查询语句大全
来源:
https://www.wpdaxue.com/remove-wordpress-old-post-slug.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_32749.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57