- wlllbl2019-04-05中级会员142162
如何让WordPress的特定内容只对管理员可见
去functions.php加入下列代碼
- - add_shortcode( 'member', 'member_check_shortcode' );
- - function member_check_shortcode( $atts, $content = null ) {
- if ( is_user_logged_in() && !is_null( $content ) && !is_feed() )
- return $content;
- return '';
- }复制代码
發表文章時候
你要的隱藏內容使用上面这个代码你要的隱藏內容是登录用户都可见的,想让的内容仅对管理员可见怎么写