WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
[resolved] [closed] Possible nomenclature conflict causing sitemap errors? (8 posts)

  1. plugins_lexblog
    Member
    Posted 1 year ago #

    Hey guys,

    Thanks so much for a great plugin. One question:

    I see at line 142 of co-authors-plus.php, you seem to be registering a taxonomy named "author". Granted, there seems to be an abstraction layer there, as the name of the taxonomy is just "$this->coauthor_taxonomy" on line 164.

    I have had problems in the past with author archive 404's when there is a taxonomy called "author" elsewhere in the theme.

    I think a similar conflict is happening because of your otherwise excellent plugin, although obviously I'm not able to connect all the dots.

    Bottom line: When your plugin is not active, our /author-sitemap.xml validates just fine as per google webmaster tools. When your plugin is active, it fails with this error message at line 4:


    We were unable to read your Sitemap. It may contain an entry we are unable to recognize. Please validate your Sitemap before resubmitting.

    The first 4 lines are:

    <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://www.lifelinelaw.com/wp-content/plugins/wordpress-seo/css/xml-sitemap-xsl.php"?>
    <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    	<url>

    Any thoughts? To further complicate matter, this sitemap is generated by the Yoast SEO plugin.

    http://wordpress.org/extend/plugins/co-authors-plus/

  2. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    When your plugin is not active, our /author-sitemap.xml validates just fine as per google webmaster tools

    Where is this sitemap coming from? Do you have a custom post type or taxonomy named 'author'?

  3. plugins_lexblog
    Member
    Posted 1 year ago #

    That sitemap is generated by the Yoast SEO plugin.

    Tomorrow I'll write a little test script to see what taxonomies are registered but, I mean, isn't there an author taxonomy being registered at like 142 of your plugin?

  4. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    isn't there an author taxonomy being registered at like 142 of your plugin?

    Correct, but if there's another 'author' taxonomy or CPT that's probably going to cause problems. Or there might be some other issue happening. Yoast's SEO plugin generates an author-sitemap.xml file for me without any fatal errors.

    You might enable WP_DEBUG temporarily to see if there's a fatal error happening, which looks like it might be possible.

  5. plugins_lexblog
    Member
    Posted 1 year ago #

    Just to be clear, I'm not claiming there is a fatal error, just that the sitemap fails google validation.

    It seems to me that the "author" taxonomy in your plugin would conflict with Yoast's attempt to generate an "author" sitemap -- his plugin is referencing "author" as in, standard wordpress user, not your taxonomy term.

    EDIT: The reason I say that is because "author" is a valid permalink component and valid parameter for the wp_query. How would other plugins know which "author" a given url string is referring to?

    But for clarity's sake, I will snoop around in debug mode and see what I see.

    Thanks very much for your comments.

  6. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Just to be clear, I'm not claiming there is a fatal error, just that the sitemap fails google validation.

    Ah, apologies. I interpreted 'The first 4 lines are:' to mean the code was fataling after that point.

    In Yoast's plugin, I think this is the problem:

    else if ( $tax = get_taxonomy( $type ) )
    	$this->build_tax_map( $tax );

    It basically generates a sitemap for every taxonomy, regardless of whether the taxonomy is public or private.

    Furthermore, inside build_tax_map(), the settings check is what's called an anti-pattern:

    if (
    			( isset( $options['taxonomies-' . $taxonomy->name . '-not_in_sitemap'] ) && $options['taxonomies-' . $taxonomy->name . '-not_in_sitemap'] )
    			|| in_array( $taxonomy, array( 'link_category', 'nav_menu', 'post_format' ) )
    		) {
    			$this->bad_sitemap = true;
    			return;
    		}

    This means the plugin is saving which taxonomies shouldn't be included, instead of whitelisting those that should.

    You can "fix" this by editing the following in admin/pages/xml-sitemaps.php:

    foreach ( get_taxonomies( array( 'public' => true ), 'objects' ) as $tax ) {

    to:

    foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {

    You'll also need to comment out the line directly after that.

    Hope this helps.

  7. plugins_lexblog
    Member
    Posted 1 year ago #

    You can "fix" this by editing the following in admin/pages/xml-sitemaps.php:

    You are referring to code within the Yoast plugin there, correct?

  8. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Correct. I've also reached out to Yoast to see if we can get a better fix in place.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.