WordPress.org

Forums

All in One SEO Pack
New hooks aiosp_sitemap_addl_pages, how do they work? (2 posts)

  1. Arturo emilio
    Member
    Posted 1 year ago #

    Hi, i've seen the new hooks to add custom urls to the sitemap, but i get an empty array when i use it. How should i use that hooks?

    Right now i've reverted the code to use the custom hook explained here:
    https://wordpress.org/support/topic/aiosp-add-urls-to-the-sitemap-by-plugin/

    Regards.

    https://wordpress.org/plugins/all-in-one-seo-pack/

  2. Peter Baylies
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Arturo emilio,

    The new filter hooks are there for adding additional pages to your sitemap; here's an example of how to use it:

    add_filter( 'aiosp_sitemap_addl_pages', 'sfwd_add_pages' );
    function sfwd_add_pages( $pages ) {
    	if ( empty( $pages ) ) $pages = Array();
    	$pages[] = Array( "loc" => "http://www.google.com/", "lastmod" => "2014-04-01T00:00:00Z", "changefreq" => "daily", "priority" => "0.1" );
    	return $pages;
    }

    If you're using indexed sitemaps, then this gets added to the sitemap_addl.xml sitemap. There are also a couple of other new hooks in this release that should give you greater control over your results.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • All in One SEO Pack
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic