Wordpress作者页面404

时间:2012-09-07 08:23:03

标签: wordpress

我在列出author.php中给定作者的所有帖子时遇到问题 除管理员外,所有用户都能正常工作。

http://somedomain.com/author/MyUser - 确定(非管理员用户!)
http://somedomain.com/author/?author=1 - 确定(管理员ID = 1)

http://somedomain.com/author/admin - 404
http://somedomain.com/author/User.Admin - 404
http://somedomain.com/author/AdminNickName - 404

wp_query如下:

$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));

$args = array( 'post_type' => 'post', 'author' =>$curauth->ID, 'posts_per_page' => 10 );
$wp_query = new WP_Query($args);

任何解决方案?非常感谢!

1 个答案:

答案 0 :(得分:0)

我遇到了完全相同的问题。这是下面的解决方案。 (我不确定为什么会这样,但确实如此。)

编辑您的Wordpress数据库表wp_users。找到您的管理员帐户并编辑“user_nicename”字段。输入您的登录名(或一些URL友好的字符串)并保存。

就是这样。在我的,该列中的原始值是“Trevor Gehman”,作者页面的URL是/ author / TrevorGehman /返回404.我将值更改为“trevorgehman”,然后url成为/ author / trevorgehman /它有效!

http://wphacks.com/change-author-archive-permalink/