我们在更新博客时,时间久了,有时同一篇是否发布过,现在很难确定,可以将以下代码添加在functions.php文件最后一个?>之前,在仪表盘首页就可以看到重复文章的ID了。
function detect_duplicate_posts() { $all_posts = get_posts(array('post_type' => 'post', 'numberposts' => -1)); $titles = array(); $duplicates = array(); foreach ($all_posts as $post) { $title = $post->post_title; if (in_array($title, $titles)) { $duplicates[] = $post->ID; } else { $titles[] = $title; } } if (!empty($duplicates)) { echo '文章源自趣课程-https://www.qukecheng.com/1066.html文章源自趣课程-https://www.qukecheng.com/1066.html'; } } add_action('admin_notices', 'detect_duplicate_posts');重复文章ID:' . implode(', ', $duplicates) . '文章源自趣课程-https://www.qukecheng.com/1066.html
文章末尾固定信息

我的微信
微信号已复制
我的微信
微信扫一扫