wordpress功能代码

/**
* 3.修改忘记密码成功界面返回链接
*/
function custom_login_url($url) {
return home_url();
}
if($_GET[“action”]==”lostpassword” || $_GET[“action”]==”resetpass” || $_GET[“action”]==”rp” || $_GET[“checkemail”]==”confirm”){
add_filter( ‘login_url’, ‘custom_login_url’);
}

/**
* 4.去除忘记密码界面底部导航
*/
function remove_nav_backtoblog() {
if($_GET[“action”]==”lostpassword” || $_GET[“action”]==”resetpass” || $_GET[“action”]==”rp” || $_GET[“checkemail”]==”confirm”){
echo’

‘;
}
}
add_action(‘login_head’, ‘remove_nav_backtoblog’);
/**
* 5让作者在 WordPress 后台只能看到自己的文章
*/
function wpjam_parse_query_useronly( $wp_query ) {
if ( strpos( $_SERVER[ ‘REQUEST_URI’ ], ‘/wp-admin/edit.php’ ) !== false ) {
if ( !current_user_can( ‘edit_others_posts’ ) ) {
global $current_user;
$wp_query->set( ‘author’, $current_user->id );
}
}
}
add_filter(‘parse_query’, ‘wpjam_parse_query_useronly’ );

/**
* 让作者在 WordPress 后台只能看到自己文章下的评论
*/
function wpdx_get_comment_list_by_user($clauses) {
if (!current_user_can(‘edit_others_posts’)) {
global $user_ID, $wpdb;
$clauses[‘join’] = “, wp_posts”;
$clauses[‘where’] .= ” AND wp_posts.post_author = “.$user_ID.” AND wp_comments.comment_post_ID = wp_posts.ID”;
};
return $clauses;
};
add_filter(‘comments_clauses’, ‘wpdx_get_comment_list_by_user’);