Skip to content

Instantly share code, notes, and snippets.

View gerard-kanters's full-sized avatar

Gerard Kanters gerard-kanters

View GitHub Profile
@gerard-kanters
gerard-kanters / functions.php
Created January 6, 2021 13:11
Filter for Yoas SEO with Wordpress to index internal search pages. Add this in functions.php of your theme.
//Let Google index search pages, otherwise following links will also stop
function index_search_robots ($robots) {
if ( is_search() ) {
return 'index,follow';
}
return $robots;
}
add_filter( 'wpseo_robots', 'index_search_robots' );
@gerard-kanters
gerard-kanters / functions.php
Created November 15, 2024 16:12
Use GEOIP in Wordpress to protect contact form.
//GeoIP gebruiken om contact pagina te beschermen tegen spammers
// Dynamisch pad bepalen voor Composer autoload
$autoload_path = ABSPATH . 'vendor/autoload.php';
if (!file_exists($autoload_path)) {
error_log('Composer autoload.php niet gevonden. Controleer of Composer correct is geïnstalleerd.');
return; // Stop het script als Composer niet beschikbaar is
}