Trying to remove the from a specific page so I don't have duplicates. Is there away to filter these out in the functions? I have already removed the canonical but wasn't able to reproduce the same with title using wp_title or wpseo_title.
function remove_canonical() {
if ( is_page(12891) ) {
add_filter( 'wpseo_canonical', '__return_false', 10, 1 );
add_filter( 'wpseo_title', '__return_false' );
add_filter( 'wp_title', '__return_false' );
}
}
add_action('wp', 'remove_canonical');
false
just disables them. Anyway, it probably doesn't matter. The last filter should return a string, so you probably want'__return_empty_string'
. That said, I might imagine that returning a non-string would have the same effect. But perhaps instead it has no effect at all (that is, the string is unchanged). If it still doesn't work, I'd try changing the priority. You want this to run last, so the priority number should be large.