Hi @regijorge,
could you post the full loop code, so I can reproduce this issue on my server?
Best regards,
Maciej
I also have this issue. get_permalink() just returns the domain.com/slug of the product, not its full path/permalink, here is my code:
` $productsForSitemap = get_posts( array(
‘numberposts’ => -1,
‘orderby’ => ‘modified’,
‘post_type’ => array( ‘product’ ),
‘order’ => ‘DESC’
) );
foreach( $productsForSitemap as $product )
{
setup_postdata($product);
$postdate = explode( ” “, $product->post_modified );
$sitemap .= “\t” . ‘<url>’ . “\n” .
“\t\t” . ‘<loc>’ . get_permalink( $product->ID ) . ‘</loc>’ .
“\n\t\t” . ‘<lastmod>’ . $postdate[0] . ‘T’ . $postdate[1] . $tempo . ‘</lastmod>’ .
“\n\t\t” . ‘<changefreq>Weekly</changefreq>’ .
“\n\t\t” . ‘<priority>0.5</priority>’ .
“\n\t” . ‘</url>’ . “\n”;
}`
Hi @amityweb,
please make sure that your code is executed after Permalink Manager URL filters.
The filters are called after ‘plugins_loaded’ hook:
https://codex.ww.wp.xz.cn/Plugin_API/Action_Reference#Actions_Run_During_a_Typical_Request
Best regards,
Maciej