wpseo_sitemap_post_type_archive_link

Filter the URL Yoast SEO uses in the XML sitemap for this post type archive.

Description

apply_filters( 'wpseo_sitemap_post_type_archive_link', (string) $archive_url, (string) $post_type ); 

Parameters (2)

0. $archive_url (string)
The URL of this archive
1. $post_type (string)
The post type this archive is for.

Usage

To run the hook, copy the example below.
  1. $archive_url = apply_filters( 'wpseo_sitemap_post_type_archive_link', $archive_url, $post_type ); 
  2.  
  3. if ( !empty( $archive_url ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the wpseo_sitemap_post_type_archive_link callback 
  2. function filter_wpseo_sitemap_post_type_archive_link( $archive_url, $post_type ) { 
  3. // make filter magic happen here... 
  4. return $archive_url
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'wpseo_sitemap_post_type_archive_link', 'filter_wpseo_sitemap_post_type_archive_link', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'wpseo_sitemap_post_type_archive_link', 'filter_wpseo_sitemap_post_type_archive_link', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/inc/sitemaps/class-post-type-sitemap-provider.php  
  1. $archive_url = apply_filters( 'wpseo_sitemap_post_type_archive_link', $archive_url, $post_type );