I found this code to have a custom title on WordPress
add_filter( 'pre_get_document_title', 'myFilterTitle', 10, 1);
function myFilterTitle($myTitle)
{
return "$myTitle here";
}
and some of my pages uses this shortcode to create content
function digitSix()
{
//some codes here;
$var = "this is custom title";
apply_filters('pre_get_document_title', $var);
return $someContent;
}
add_shortcode("i_digit6", "digitSix");
I was able to modify the title but it only gives "here" since it is a hard coded text inside the function myFilterTitle($myTitle)
It seems that the argument $myTitle I passed wasn't captured by the function.
return apply_filters('pre_get_document_title', $var);