1.文章详情页末尾自动添加微信公众号二维码
vim wp-includes/post-template.php
function get_the_content( $more_link_text = null, $strip_teaser = false, $post =... )
......
// yanjingang: add wx qrcode
if($more){
$wxqrcode = '<p><img loading="lazy" class="alignnone size-large wp-image-3634" src="https://blog.yanjingang.com/wp-content/uploads/2020/04/piglab_wx-1024x374.png" alt="" width="625" height="228" srcset="https://blog.yanjingang.com/wp-content/uploads/2020/04/piglab_wx-1024x374.png 1024w, https://blog.yanjingang.com/wp-content/uploads/2020/04/piglab_wx-300x109.png 300w, https://blog.yanjingang.com/wp-content/uploads/2020/04/piglab_wx-768x280.png 768w, https://blog.yanjingang.com/wp-content/uploads/2020/04/piglab_wx-624x228.png 624w, https://blog.yanjingang.com/wp-content/uploads/2020/04/piglab_wx.png 1710w" sizes="(max-width: 625px) 100vw, 625px"></p>';
$output .= $wxqrcode;
}
return $output;
}
2.控制自动保存的修订记录数量,避免posts表里都是修订记录
vim wp-config.php
define('WP_DEBUG', false);
// yanjingang add
/** 保留最新 3 次的修订记录 */
define('WP_POST_REVISIONS', 3);
/** 每隔 5分钟 自动保存一次 */
define('AUTOSAVE_INTERVAL', 300);
删除历史修订记录:
delete from blog_posts where post_type="revision";