• Resolved pfsm999

    (@pfsm999)


    Hi,

    I try to understand the process of the sitemap inside Yoast.

    I’ve got a sitemap.xml :
    https://paul-fsm.net/sitemap_index.xml

    My custom post type are declared with public = true.

    I don’t find my custom type post inside the main XML.
    They are done when i go on :
    https://paul-fsm.net/ecole-sitemap.xml or https://paul-fsm.net/?sitemap=ecole
    https://paul-fsm.net/emploi-sitemap.xml
    https://paul-fsm.net/diplome-sitemap.xml

    For information : I use your htaccess instructions :
    https://kb.yoast.com/kb/xml-sitemaps-apache/

    I use Yoast Free edition.

    • I already try to disabled / enabled sitemap inside yoast : Nothing change.
    • I already try to desactivate / reactivate yoast plugin : Nothing change
    • I already try to empty the cache with W3 Cache : Nothing change
    • I already try to desactivate / reactivate W3 cache plugin : Nothing change again.

    I check your code and i put some line in commentary :

    Inside : wordpress-seo/inc/sitemaps/class-sitemap.php (line 224 & 226)

    public function redirect( $query ) {
    
    		if ( ! $query->is_main_query() ) {
    			return;
    		}
    
    		$xsl = get_query_var( 'xsl' );
    
    		if ( ! empty( $xsl ) ) {
    			$this->xsl_output( $xsl );
    			$this->sitemap_close();
    
    			return;
    		}
    
    		$type = get_query_var( 'sitemap' );
    
    		if ( empty( $type ) ) {
    			return;
    		}
    
    		$this->set_n( get_query_var( 'sitemap_n' ) );
    
    		//if ( ! $this->get_sitemap_from_cache( $type, $this->current_page ) ) {
    			$this->build_sitemap( $type );
    		//}
    
    		if ( $this->bad_sitemap ) {
    			$query->set_404();
    			status_header( 404 );
    
    			return;
    		}
    
    		$this->output();
    		$this->sitemap_close();
    	}

    And when i do that : nothing change when i check the normal URL :
    https://paul-fsm.net/sitemap_index.xml

    BUT when i add a parameter : like that :
    https://paul-fsm.net/sitemap_index.xml?toto=1

    The sitemap update with my custom post type !
    AND I DON’T UNDERSTAND WHY !

    I try everything : Change my priority init hook for my custom post type, review all my code … don’t working !

    Could you please help me ?

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Sitemap custom type post’ is closed to new replies.