Add Custom URLs to the All in One SEO Sitemap
Adds pages that WordPress does not manage, such as static files or app routes, to All in One SEO's sitemap.
Opens WPIDE on
Code
// Paths to add, relative to the site root.
$wpide_aioseo_extra_paths = array( '/app/', '/pricing-calculator/' );
add_filter( 'aioseo_sitemap_additional_pages', function ( $pages ) use ( $wpide_aioseo_extra_paths ) {
foreach ( $wpide_aioseo_extra_paths as $path ) {
$pages[] = array(
'loc' => home_url( $path ),
'lastmod' => gmdate( 'Y-m-d H:i:s' ),
'changefreq' => 'weekly',
'priority' => 0.6,
);
}
return $pages;
} );
Notes
Paths are relative to your homepage. AIOSEO Pro also has an "Additional Pages" setting.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.