
wordpress
施大力出奇迹
半路出家
展开
-
WordPress 常用数据库SQL查询语句大全
1.删除所有未使用的标签DELETE a,b,cFROM wp_terms AS aLEFT JOIN wp_term_taxonomy AS c ON a.term_id = c.term_idLEFT JOIN wp_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_idWHERE c.taxonomy = 'post_tag' AND c.count = 02.删除所有文章修订版本(Revisions)以及它们原创 2022-03-10 11:53:00 · 561 阅读 · 0 评论 -
wordpress 禁止用户角色登录后台
//防止普通会员后台更新资料if ( is_admin() && ( !defined( 'DOING_AJAX' ) || !DOING_AJAX ) ) { $current_user = wp_get_current_user(); $user_role = $current_user->roles[0]; //禁止列表 $roles = [ get_option('default_role'), 'co原创 2022-03-10 11:42:57 · 346 阅读 · 0 评论 -
wordpress 后台分类改为单选
/** * 后台分类改为单选 * 设置上下篇的时候需要设置单选 */function wpse_139269_term_radio_checklist( $args ) { if ( ! empty( $args['taxonomy'] ) && in_array($args['taxonomy'], ['news-cat']) /* <== Change to your required taxonomy */ ) { if ( empty( $a原创 2022-03-10 11:02:35 · 177 阅读 · 0 评论 -
wordpress 解决上传中文附件出现乱码
/** * 上传中文附件出现乱码 */function my_upload_file($filename) { $parts = explode('.', $filename); $filename = array_shift($parts); $extension = array_pop($parts); foreach ((array)$parts as $part) $filename .= '.' . $part;原创 2022-03-10 10:58:23 · 257 阅读 · 0 评论 -
wordpress 修改文章发布时间格式为几天前
/** * 修改时间的显示格式为几天前 */function Bing_filter_time($post_id){ global $post ; $to = strtotime(current_time('mysql')); $from = strtotime(get_the_time('Y-m-d H:i:s',$post_id)); $diff = (int) abs($to - $from); if ($diff <= 3600原创 2022-03-10 10:55:47 · 358 阅读 · 0 评论 -
wp 文章作者列表显示不全
wp 文章作者列表显示不全原创 2022-03-10 10:51:46 · 185 阅读 · 0 评论