Mar 03

This piece of code will allow any user with the capability of ‘moderate_comments’, to include a shortcode within a post comment. If the user does not have this permission, any shortcodes will be displayed as normal text. The code should be placed inside your theme’s functions.php file.

This is useful when combined with affiliate marketing plugins that allow you to display a clickable ad using a shortcode. A visitor to your site might post a comment on an article, requesting a recommendation for a product. You can then reply to their comment, and include a affiliate link or banner ad that advertises the product in question.

For example, you may post an article about Tennis, and a user may request a recommendation for a suitable tennis racket. You can then reply with a recommendation for a racket, with an advertisement for that racket that any user who reads that ad may decide to click.

function filterComments($comments)
{
	$filtered_comments = array();
	foreach ($comments as $comment)
	{
		// if not registered
		if ($comment->user_id == 0)
		{
			$filtered_comments[] = $comment;
		}
		else
		{
			$comment_author = new WP_User($comment->user_id);
			// if has capability 'moderate_comments'
			if ($comment_author->has_cap('moderate_comments'))
			{
				$comment->comment_content = do_shortcode($comment->comment_content);
				$filtered_comments[] = $comment;
			}
			else
			{
				$filtered_comments[] = $comment;
			}
		}
	}
	return $filtered_comments;
}

add_filter( 'comments_array', 'filterComments' );
css.php
  • https://faire-revenir-son-ex.com/sitemap.txt
  • https://everestgliders.com/sitemap.txt
  • https://behroo165.com/sitemap.txt
  • https://afftray.com/sitemap.txt
  • https://newsify.press/sitemap.txt
  • https://2bfoot.com/sitemap.txt
  • https://pantryz.com/sitemap.txt
  • https://nextgendataguru.com/sitemap.txt
  • https://wnewstv.com/sitemap.txt
  • http://i-park.org/sitemap.txt
  • https://10xtravel.com/sitemap.txt
  • https://edebiyatist.com/sitemap.txt
  • https://ytiyonkers.org/sitemap.txt
  • https://healthynights.co/sitemap.txt
  • https://3dmodely.ru/sitemap.txt
  • https://499football.com/sitemap.txt
  • https://admselenga.ru/sitemap.txt
  • https://ambia.ru/sitemap.txt
  • https://arteninaoltu.com/sitemap.txt
  • https://artislogistics.pro/sitemap.txt
  • https://artmama-mouse.ru/sitemap.txt
  • https://audit-research-center.com/sitemap.txt
  • https://avtoznak.ru/sitemap.txt
  • https://baikal-sera.ru/sitemap.txt
  • https://bethazor.com/sitemap.txt
  • https://bio7septic.ru/sitemap.txt
  • https://biotique-shop.ru/sitemap.txt
  • https://biserstav.ru/sitemap.txt
  • https://blowcamp.com/sitemap.txt
  • https://burger1.rest/sitemap.txt
  • http://wpsecure.be
  • http://wpskill.com
  • https://wpua.cloud
  • http://wresidencescostarica.com
  • https://wsportals.com
  • https://wssrradio.com
  • https://ws-start.ru
  • https://wyomingadvocates.com
  • http://wzonez.com
  • https://xanahosting.com
  • https://xcitercalls.com
  • https://xelbookings.com
  • https://xenvious.com
  • https://ximenamargain.com
  • http://xn--12cc2eo0ezb5as.com
  • http://xn--42cgaan6dxdxace0c1dg8cs4cu3n9fdh.com
  • http://xn--82cz5bqv8f.com
  • http://xn--thringen-verzaubert-69b.de
  • https://xrsw.uk
  • https://xsytikaa.com
  • https://yamaguchi-sokkyo.or.jp
  • https://yaminpublishing.com
  • https://yashhomes.ca
  • http://yellbitcoin.com
  • http://yestrading.net
  • https://yeungmarineholdings.com
  • https://yilsezklima.com
  • https://ymaa.pl
  • https://ymaaeurope.com
  • https://yogaineverydaylife.com
  • https://yogaworlds.in
  • http://yosoy.esy.es
  • http://youcalltheshots.net
  • https://youlooklovely.co
  • http://youlooklovely.photography
  • http://younkakura.com
  • https://yourroadstosuccess.com
  • https://youthfulandageless.com
  • https://yoyoriyu.com
  • https://ytiyonkers.org
  • https://yukomexico.com
  • https://yulehit.com
  • http://yusufyarar.com
  • http://yvonnevandermeer.nl
  • https://zabumutua.com
  • http://zakerhaghighi.ir
  • https://zakynthos2019.nl
  • https://zamacon.es
  • https://zbudujdom.net
  • https://zebiam.com