Make specific tag visible only to logged in users in front-end

Add the add_filter to your theme’s functions.php file function myTags() { $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { if($tag->slug==’your specific tag slug’){ if(is_user_logged_in() ) { echo ‘<a href=”https://wordpress.stackexchange.com/questions/138827/.get_tag_link($tag->term_id).” >’.$tag->name . ‘</a> ‘; } } else { echo ‘<a href=”https://wordpress.stackexchange.com/questions/138827/.get_tag_link($tag->term_id).”>’.$tag->name . ‘</a> ‘; } } } } add_filter(‘the_tags’, ‘myTags’);

Do I need to include ‘else’ and/or ‘endif’?

You just need an else block: //templating syntax if($condOne): //do stuff if $condOne is true elseif($condTwo): //do stuff if $condOne is false and $condTwo is true else: //do stuff if both $condOne and $condTwo are false endif; //braces syntax if($condOne){ //do stuff if $condOne is true }elseif($condTwo){ //do stuff if $condOne is false and $condTwo … Read more

is_home() vs is_archive()

To properly understand the difference, you have to dig into the WordPress Core is_archive() (defined in wp-includes/query.php#L140) checks any type of archive page. These archive pages is defined in the WP_Query class in wp-includes/query.php#L1615 lines 1615 and line 1616 1615 if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax ) 1616 … Read more

How can we use conditional tags in plugins?

TL,DR; You are hooking early. In the plugin, the css file loads site-wide by default, I want to load it only on the single post. It’s a very good thought many developers don’t take this into account while developing themes/plugins. is_single() isn’t working in plugins Where are you using is_single template tag in WP run … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)