Halloween Sale 15% off Ends in See the plans
PHP

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.

Don’t have WPIDE yet? Install it on your site

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

  1. Install WPIDE on your WordPress site (it is free) and open Code Snippets.
  2. Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
  3. It is added inactive: review the code and settings, then switch it on.

Have a snippet worth sharing?

Publish it to the library from WPIDE or right here. Sign in with any WordPress site that runs WPIDE, free or Pro. Public snippets are reviewed by the WPIDE team before they appear.

Which site should get this snippet?

Enter the address of your WordPress site. WPIDE opens there in a new tab with the snippet ready to review and save.

Remembered in this browser only, so you are asked once.

Report this snippet

Tell the WPIDE team what is wrong: broken code, something harmful, spam or copied work.