If your theme is using the WordPress site tagline, you should be able to filter it. get_bloginfo( 'description' )
will call get_option( 'blogdescription' );
, and we can filter the value of an option using the option_{$option}
hook.
Let’s suppose, for this code sample, that you want to change the tagline on 3 pages, with the titles Kindergarten, Nursery School, and Babysitting.
add_filter( 'option_blogdescription', 'wpse368031_change_tagline' );
function wpse368031_change_tagline( $tagline ) {
$pages = array( 'Kindergarten', 'Nursery School', 'Babysitting' );
if ( is_page( $pages ) ) {
$tagline="ABC Nursery";
}
return $tagline;
}
Try adding this code to your active theme’s functions.php
file.