我使用此代码在单个帖子和特定类别中添加自定义CSS:
function hide_author() {
global $post;
if (is_single($post->ID) && in_category(array( \'category 1\', \'Category 2\'), $post->ID)) {
?>
<style type="text/css">
.author-info {display: none;}
</style>
<?php
}
}
add_action(\'wp_head\', \'hide_author\');
我想知道,如果某些用户(通过用户ID或用户名)发布了一篇文章,如何启动wp\\U head操作?我可以使用wp\\u set\\u current\\u user()吗?如果是的话,如何准确地使用它?谢谢