Selamlar no-follow algılandığı için bazı linkleri değiştirmem gerekiyor.
Örnek veriyorum
<a> href="https://api.whatsapp.com/send/?phone=908508408270&text&type=phone_number &app_absent=0" </a>
şeklinde bir linkimiz olduğunu düşünelim link nofollow özellikli geçiyor bu doğru bunda sorun yok yapmak istediğim şey href olan linki html attributesi olan onclick ile değiştirmek istiyorum
Tek tek uğraşması zor oluyor çünkü 100 e sayfa var ve her sayfada 2-3 link bulunuyor
bunu toplu halde kısa yoldan nasıl halledebilirim
yardımcı olabilecek varsa şimdiden teşekkür ederim
wordpress prolarına bi sorum var
10
●324
- 24-07-2025, 17:05:08
- 24-07-2025, 17:16:06WordPress admin panelinden
Görünüm → Tema Dosya Düzenleyici → footer.php dosyasını aç.
</body> etiketinden hemen önce aşağıdaki kodu ekle:
<script>
document.addEventListener("DOMContentLoaded", function () { document.querySelectorAll('a[href*="api.whatsapp.com"]').forEach(function (a) { const originalHref = a.getAttribute('href'); a.setAttribute('onclick', `window.location.href='${originalHref}'; return false;`); a.setAttribute('href', '#'); }); });
</script>
- Sayfa yüklendiğinde tüm api.whatsapp.com içeren href'leri bulur.
- Onları onclick fonksiyonuna çevirir.
- href'i # yapar, yani SEO botları görmez.
- 24-07-2025, 17:17:22hocam gpt ye sorduysan 10 farklı kod denedim olmadı xdSaysa adlı üyeden alıntı: mesajı görüntüle
- 24-07-2025, 17:27:46
- 24-07-2025, 22:58:59
<script> document.addEventListener('DOMContentLoaded', () => { document.querySelectorAll('a[href*="api.whatsapp.com"]').forEach(a => { const url = a.getAttribute('href'); a.removeAttribute('href'); a.setAttribute('onclick', `window.open('${url}','_blank')`); }); }); </script>bunu dener misiniz? - 25-07-2025, 01:16:42
<script> document.addEventListener('DOMContentLoaded', () => { document.querySelectorAll('a[href*="api.whatsapp.com"]').forEach(a => { const url = a.href; a.removeAttribute('href'); a.addEventListener('click', e => { e.preventDefault(); window.open(url, '_blank'); }); }); }); </script>