Last active
June 17, 2025 09:23
-
-
Save wp-seopress/718bc5cf7369241c3a65a9ea58aabaef to your computer and use it in GitHub Desktop.
Filter terms in HTML sitemap titles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('seopress_sitemaps_html_display_terms_only', 'sp_sitemaps_html_display_terms_only', 10, 2); | |
function sp_sitemaps_html_display_terms_only($display_terms_only, $cpt_key) { | |
// Display terms only for products | |
if ($cpt_key == 'product') { | |
return true; | |
} | |
return $display_terms_only; | |
} | |
add_filter('seopress_sitemaps_html_term_name', 'sp_sitemaps_html_term_name', 10, 2); | |
function sp_sitemaps_html_term_name($term_name, $term) { | |
// Modify term name for products | |
if ($term->taxonomy == 'product_cat') { | |
return 'Product Category: ' . $term_name; | |
} | |
return $term_name; | |
} | |
add_filter('seopress_sitemaps_html_terms_output', 'sp_sitemaps_html_terms_output', 10, 3); | |
function sp_sitemaps_html_terms_output($html, $terms, $cpt_key) { | |
// Modify the terms HTML output | |
if ($cpt_key == 'product') { | |
return 'Product Terms: ' . $html; | |
} | |
return $html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment