The solution should is this:
add_filter( 'wpseo_xml_sitemap_post_priority', 'my_custom_post_xml_priority', 10, 3 );
function my_custom_post_xml_priority( $return, $type, $post) {
if($type == 'page') {
switch ($post->ID) {
case '8':
case '395':
case '342':
$return = 0.9;
break;
case '5':
$return = 1.00;
break;
case '620':
case '703':
case '603':
case '688':
case '695':
case '614':
case '684':
case '639':
case '628':
case '539':
case '542':
case '521':
case '509':
case '517':
case '528':
case '533':
case '536':
case '548':
case '545':
case '525':
case '551':
$return = 0.7;
break;
default:
$return = 0.5;
break;
}
} elseif ($type == 'post') {
$return = 0.8;
}
return $return;
}
I think that $post
is an WP_Post object, then you will have to compare the property ID on the switch.