WordPress filter hook

wpseo_xml_sitemap_post_priority

Fired by 2 WordPress plugins, running on 20+ sites between them.

“Filter the priority of the URL Yoast SEO uses in the XML sitemap.”

How to use wpseo_xml_sitemap_post_priority

It's a filter: your callback receives the value and 2 more arguments, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'wpseo_xml_sitemap_post_priority', function( $return, $post_type, $post ) {
	// Change $return here.
	return $return;
}, 10, 3 );

Argument names come from Dynamic SEO Child Pages's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

2 plugins that fire wpseo_xml_sitemap_post_priority

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Dynamic SEO Child Pages icon Dynamic SEO Child Pages10+ installs apply_filters( 'wpseo_xml_sitemap_post_priority', $return, $post->post_type, $post ) inc/class-dscp-sitemap.php:527
  2. Integration of Yoast wordpress SEO module with mqtranslate module icon Integration of Yoast wordpress SEO module with mqtranslate module10+ installs apply_filters( 'wpseo_xml_sitemap_post_priority', $url['pri'], $p->post_type, $p ) inc/class-sitemaps-mqtranslate-integr.php:803

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.