<?php
/**
* Plugin Name: GeekBlog: Query Param Hygiene
* Description: Usuwa parametr wordfence_syncAttackData i podobne smieci z generowanych linkow paginacji, przekierowuje zasmiecone adresy paginacji na czyste, oznacza reszte jako noindex i blokuje je w robots.txt. Dodane 2026-09-21.
* Version: 1.0
* Author: GeekBlog
*/
defined( 'ABSPATH' ) || exit;
class GB_Query_Param_Hygiene {
public static function junk() {
return array(
'wordfence_syncAttackData',
'wordfence_lh',
'wordfence_logHuman',
'wfwaf-authcookie',
);
}
public static function init() {
add_filter( 'get_pagenum_link', array( __CLASS__, 'clean' ), 99 );
add_filter( 'paginate_links', array( __CLASS__, 'clean' ), 99 );
add_filter( 'rank_math/frontend/canonical', array( __CLASS__, 'clean' ), 99 );
add_action( 'template_redirect', array( __CLASS__, 'guard' ), 1 );
add_filter( 'robots_txt', array( __CLASS__, 'robots' ), 20 );
}
public static function clean( $url ) {
if ( ! is_string( $url ) || false === strpos( $url, '?' ) ) {
return $url;
}
return remove_query_arg( self::junk(), $url );
}
public static function has_junk() {
foreach ( self::junk() as $key ) {
if ( isset( $_GET[ $key ] ) ) {
return true;
}
}
return false;
}
public static function guard() {
if ( is_admin() || is_user_logged_in() ) {
return;
}
if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || ( defined( 'DOING_CRON' ) && DOING_CRON ) || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) {
return;
}
if ( ! self::has_junk() ) {
return;
}
$uri = isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '';
// Adresy paginacji z doklejonym parametrem to czysty smiec po crawlerze.
// Wordfence odpala swoj sync tylko na biezacym adresie, wiec paginacje mozna bezpiecznie
// sprowadzic jednym 301 do czystego adresu. Reszta dostaje tylko noindex, zeby nie
// psuc wlasciwego mechanizmu Wordfence na stronie glownej i wpisach.
if ( false !== strpos( $uri, '/page/' ) || is_paged() ) {
$clean = remove_query_arg( self::junk(), home_url( $uri ) );
if ( $clean && $clean !== home_url( $uri ) ) {
wp_safe_redirect( $clean, 301 );
exit;
}
}
if ( ! headers_sent() ) {
header( 'X-Robots-Tag: noindex, nofollow', true );
}
}
public static function robots( $output ) {
$rules = "\n# Smieci po crawlerach i wtyczkach: nie indeksujemy i nie crawlujemy.\n";
foreach ( self::junk() as $key ) {
$rules .= 'Disallow: /*' . $key . "\n";
}
return $output . $rules;
}
}
GB_Query_Param_Hygiene::init();
Privacy - GeekBlog
Home » Posts Tagged "Privacy" (Page 5)
Browsing: Privacy Stories about who is collecting your data, what they do with it, and the tools, laws and settings that help you take some of that control back.
The Government Accountability Office reviewed DOGE’s Wall of Receipts and found 2,503 contracts listed as terminated that were never cancelled, plus 96% of grant savings it could not verify at all. Here is what the audit actually found and why the dashboard was the problem.
Apple’s Find My keeps directing strangers to homes that never had their lost iPhones. Here’s the Wi-Fi positioning flaw that creates these “magnet houses,” why the same story keeps repeating, and exactly what to do whether you lost the phone or answered the door.
Previous
1
…
3
4
5