Hide dates for posts in some categories
-
I would like to hide dates inside Google for some categories, but not in all.
Is there a way doing this?
The wpseo_opengraph_show_publish_date filter will be executed only if NOT is_singular(‘post’). So I think, I can’t use it.
But I don’t understand the whole function publish_date(). apply_filters will be called with 3 parameters, but if I’m right its allowed to use two parameters only.
Can you replace
if ( ! is_singular( ‘post’ ) ) {
if ( false === apply_filters( ‘wpseo_opengraph_show_publish_date’, false, get_post_type() ) ) {
return false;
}
}with
if ( false === apply_filters( ‘wpseo_opengraph_show_publish_date’, is_singular( ‘post’ ) ) ) {
return false;
}So the wpseo_opengraph_show_publish_date filter will be applied for every post, but the date will be shown for singular posts only.
But maybe I’m totally wrong, since I didn’t find out, where publish_date() is called…
- The topic ‘Hide dates for posts in some categories’ is closed to new replies.