$(document).ready(function() { $('.post-card').each(function() { var shouldHide = false; $(this).find('a').each(function() { var linkText = $(this).text().trim(); if (linkText === "Uncategorized") { shouldHide = true; return false; } }); if (shouldHide) { $(this).css('display', 'none'); } }); });