I have a function to change the locale of the posts
function change_og_locale( $locale ) {
return 'es_ES';
}
add_filter( 'wpseo_locale', 'change_og_locale' );
Now, I would like to fire it only if the post has a certain ID. I've tried with
function change_og_locale($locale ) {
if ( $post_id == 52397 ) {
return 'es_ES';
}
return $locale;
}
add_filter('wpseo_locale', 'change_og_locale');
But it seems not working