开发者

wordpress updating deprecated get_the_author function

I am updating an older theme and am getting this message.

Notice: get_the_author was called with an argument that is <strong>deprecated</strong> since version 2.1 with no alternative available. in /srv/www/virtual/example.com/htdocs/zzblog/wp-includes/functions.php on line 3468 home page pageid-641 page-author-test page-template page-template-MIMindexMOD-php">

I can find the call in my themes functions.php as follows:

c[] = 'page-author-' . sanitize_title_with_dashes(strtolower(get_the_author('login')));

this is the only reference开发者_如何学Python to get_the_author that I can find. In the wordpress codex it says the entire function get_the_author is depreciated (along with the passed argument) so would like to update but not sure how.


Just replace the line:

c[] = 'page-author-' . sanitize_title_with_dashes(strtolower(get_the_author('login')));

by this:

c[] = 'page-author-' . sanitize_title_with_dashes(strtolower(get_the_author()));

The function as appears in http://codex.wordpress.org/Function_Reference/get_the_author isn't deprecated, only is deprecated the parameter, because now the function returns always the user display name, so no need to specify that the desired return value is the user 'login'.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜