For Archives pages taxonomy titles and ACF:
The woocommerce_page_title
works for shop page and taxonomy archive pages, so in ACF:
Then in a product category for example (here "Clothing"), you set your custom title:
In the code, you need to get the queried object (the WP_Term
object) for the taxonomy archive pages and to set it as following:
add_filter( 'woocommerce_page_title', 'custom_title' );
function custom_title( $page_title ) {
if ( ! function_exists('get_field') || is_search() )
return $page_title;
if ( is_tax() ) {
$term = get_queried_object();
$the_id = $term->taxonomy . '_' . $term->term_id;
} elseif ( is_shop() ) {
$the_id = wc_get_page_id( 'shop' );
}
return get_field( "custom_tag_h1", $the_id ) ? get_field( "custom_tag_h1", $the_id ) : $page_title;
}
Code goes in function.php file of your active child theme (or active theme). Tested and work.