add_action( 'wp_loaded', array( $this, 'add_yoast_schema' ) );
add_filter('pre_get_document_title', array($this, 'replace_title_text_pre'), 999, 1);
public function add_yoast_schema() {
//add_filter('wpseo_opengraph_title', array($this, 'custom_og_title'),999,1);
//add_filter('wpseo_opengraph_title', array($this, 'custom_og_title'),999,1);
//add_filter('wpseo_title', array($this, 'custom_og_title'),999,1);
//add_filter('wpseo_title', array($this, 'custom_og_title'),999,1);
add_filter( 'wpseo_title', array( $this, 'replace_title_text_pre' ), 999, 1 );
add_filter( 'wpseo_opengraph_title', array( $this, 'replace_title_text_pre' ), 999, 1 );
add_filter( 'wpseo_metadesc', array( $this, 'replace_title_text_pre' ), 999, 1 );
add_filter( 'wpseo_opengraph_desc', array( $this, 'replace_title_text_pre' ), 999, 1 );
}
public function replace_title_text_pre($title) {
//$title = get_the_title();
$title = str_replace('{Title}', 'Dominant', $title);
$title = str_replace('{title}', 'Submissive', $title);
return $title;
}