-
Notifications
You must be signed in to change notification settings - Fork 209
Filter author archive #441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter author archive #441
Conversation
Fixes warning: `Warning: sprintf(): Too few arguments in /path/wp-content/plugins/co-authors-plus/php/class-coauthors-guest-authors.php on line 487` Warning surfaces when deleting a guest author that is mapped to a WP user
|
I think this is actually not fixing the underlying problem. The problem is that the query doesn't contain the author requested. I think the problem is in I have forked CAP for my own purposes, so my code is slightly different and will need adapted, but this works for me. In $author_name = sanitize_title( get_query_var( 'author_name' ) );
if ( ! $author_name ) {
return;
}...with $author_id = absint( get_query_var( 'author' ) );
$author_name = sanitize_title( get_query_var( 'author_name' ) );
if ( isset( $author_id ) ) {
// get author by id
$author = get_user_by( 'id', $author_id );
} elseif ( isset( $author_name ) ) {
// get author by specified name
$author = get_user_by( 'login', $author_name );
} else {
// no query variable was specified; not much we can do
return;
}(need to change This means that the |
|
This actually breaks get_the_archive_title() for other types of archives. It should be this: public function filter_author_archive_title($title) {
if ( is_author() ) {
$author = sanitize_user( get_query_var( 'author_name' ) );
/* translators: Author archive title. 1: Author name */
$title = sprintf( __( 'Author: %s' ), '<span class="vcard">' . $author . '</span>' );
}
return $title;
} |
|
Hi Daniel, |
As per #351, the author archive posts page title did not reflect the correct author. This patch solves the issue!