I have a problem with my XML sitemap. I want insert frequency and priority dynamically, but I don't understand the action register_sitemap
This is my code:
function insert_xml($content){
global $post;
$xml_relationship = get_field('c_page_relationship', $post->ID);
function my_custom_post_freq($default, $url, $post_id) {
return 'hourly';
}
add_filter('wpseo_sitemap_post_single_change_freq', 'my_custom_post_freq', 10, 3);
function my_custom_post_xml_priority($default, $url, $post_id) {
return 0.6;
}
add_filter('wpseo_xml_sitemap_post_priority', 'my_custom_post_xml_priority', 10, 3);
return $xml_relationship;
}
add_action('wpseo_do_sitemap_', 'insert_xml');
I am using acf custom fields, to change the prority and frequency which I get from $post_id
, the functions about this are not ready, but is the finality. I want to insert when the XML is created for yoast, I find this in the API docs yoast wpseo_do_sitemap_<$type>
but i dont understand what is <$type>
$type can not be a valid post type or taxonomy, when they are this action will not trigger
What does it need to be?