-
Notifications
You must be signed in to change notification settings - Fork 882
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
Yoast SEO 7.0.1 Co-Authors Plus Plugin Incompatibility #9147
Comments
Thank you for reporting this bug. |
Related #6343. I think this needs... Work. Not sure if it needs work on our side. I'll reach out to one of the devs of CoAuthor Plus on WP Slack (@danielbachhuber). |
Hi folks, I'm no longer actively involved with Co-Authors Plus development. I'd suggest creating an issue in https://github.com/automattic/co-authors-plus/issues |
Hey any updates on this? I don't see any open issues about this over in the above repo. I can open one if we still need it. |
It looks like the Yoast SEO doesn't even make a sitemap for the "guest authors" now, so while the links are not broken, they no longer even exist for me (which is better than broken). However, I would love for it to work again like it did years ago. |
@gregarios It's because CPT guest-author isn't publicly queryable. You could enable it with this snippet: function cpt_guest_authors_sitemap( $post_types ) {
$post_types['guest-author'] = 'guest-author';
return $post_types;
}
add_filter( 'wpseo_accessible_post_types', 'cpt_guest_authors_sitemap' ); Next step is adding filter |
Your code does make the co-authors sitemap appear in the list, but I'm not sure what to do with your instruction for the wpseo_xml_sitemap_post_url filter. All the links in the sitemap are broken because they all look like the attached image: All the links in the website are in the normal format: |
Filter add_filter( 'wpseo_xml_sitemap_post_url', 'myseo_sitemap_guest_author_url', 10, 2 );
function myseo_sitemap_guest_author_url( $url, $author ) {
if ( is_object( $author ) && $author->post_type === 'guest-author' ) {
$user_nicename = preg_replace( '`^cap-`', '', $author->post_name );
$url = get_author_posts_url( $author->ID, $user_nicename );
}
return $url;
} Please test if you can. |
Just to be clear to readers of this thread... to fix this problem, this is the code I placed in my functions.php file in my theme as requested:
|
I'll try to create PHP class for integration between Co Authors and Yoast SEO plugin based on these snippets. When I finish this, I'll submit PR to co-authors repo and I hope that will be fixed in next releases. |
It certainly is a huge improvement. There's only one issue left that I've experienced: |
I don't have enabled guest authors on production servers. I've created a test website for this issue (with only couple authors). I didn't yet test mapping between WP users and guest authors. I'll try to investigate it. |
Here are two screenshots. Only one real user is on the server other than the admin, to be mapped to its associated guest user: In this example, both of the links to the profiles work, and both appear identical except for the hyphen and underscore difference, and the difference that the "real" profile page does not show the list of articles she wrote, while the "guest author" profile page does. |
I was able to reproduce your issue. I think that the easiest solution is removing "linked accounts" from author sitemap (there is method /**
* Restore Co-Authors Plus Plugin & Yoast SEO Sitemap Compatibility.
*/
function myseo_accessible_post_types( $post_types ) {
$post_types['guest-author'] = 'guest-author';
return $post_types;
}
add_filter( 'wpseo_accessible_post_types', 'myseo_accessible_post_types' );
function myseo_check_sitemap_type( $type ) {
if ( $type === 'guest-author' ) {
add_filter( 'wpseo_xml_sitemap_post_url', 'myseo_sitemap_guest_author_url', 10, 2 );
} elseif ( $type === 'author' ) {
unregister_taxonomy( 'author' );
add_filter( 'wpseo_sitemap_entry', 'myseo_sitemap_author_excludes_linked_accounts', 10, 3);
}
return $type;
}
add_filter( 'wpseo_build_sitemap_post_type', 'myseo_check_sitemap_type' );
function myseo_sitemap_guest_author_url( $url, $guest_author ) {
if ( is_object( $guest_author ) ) {
$user_nicename = preg_replace( '#^cap\-#', '', $guest_author->post_name );
$url = get_author_posts_url( $guest_author->ID, $user_nicename );
}
return $url;
}
function myseo_sitemap_author_excludes_linked_accounts( $url, $type, $author ) {
static $linked_account_user_ids;
if ( ! isset( $linked_account_user_ids ) ) {
global $coauthors_plus;
$linked_account_user_ids = array();
if ( is_object( $coauthors_plus->guest_authors ) ) {
$linked_account_user_ids = wp_list_pluck(
$coauthors_plus->guest_authors->get_all_linked_accounts(),
'ID'
);
}
}
if ( ! empty( $linked_account_user_ids ) && is_object( $author ) &&
in_array( $author->ID, $linked_account_user_ids, true )
) {
return false;
}
return $url;
} |
Tried this code, but I actually can't use it because I can't map the accounts without losing the list of posts on their profiles. It does remove the mapped authors from the sitemap, however. Also if only mapped authors are in the sitemap, it lists the sitemap but clicking on it gives a 404 not found. |
Hi and time to ressurrect this issue. |
I was able to get mine to work by including this in my functions.php file: `
function myseo_sitemap_guest_author_url( $url, $author ) { function myseo_remove_author_taxonomy( $type ) { |
I was having trouble resolving the
|
Please inform the customer of conversation # 668286 when this conversation has been closed. |
I am experiencing the issue with noindex being set on guest authors since upgrading past version 14 and I would like to address it by writing a class that extends Is that possible? |
To expand a bit on @bengreeley 's solution above, using the
|
* fix(yoast): prevent no-indexing of guest authors' archive pages Closes Yoast/wordpress-seo#9147 Closes Automattic/newspack-plugin#1506 * Fixes the og:url attribute for gues author archive Co-authored-by: Leo Germani <[email protected]>
@barryceelen 's solution wasn't working for me (not seeing a
|
Please give us a description of what happened.
When using Yoast SEO 7.0.1 the sitemap created for the Co-Authors Plus "guest-authors" taxonomy gives incorrect URL locations, resulting in 404 Not Found pages listed in the sitemap. If the taxonomy is excluded from the sitemap, a meta robots tag telling search engines to "noindex" the working pages is added. See this URL as an example: https://portofdewatto.com/author/leanna-krotzer/
Please describe what you expected to happen and why.
The sitemap for Co-Authors Plus "guest-authors" taxonomy pages should be correctly listed in the sitemap. OR, the ability to exclude that taxonomy from the sitemap should NOT ALSO add "noindex" meta tags to perfectly functioning pages.
How can we reproduce this behavior?
Technical info
The text was updated successfully, but these errors were encountered: