Amirhossein HosseinpourAmirhpCom
Resume Book a consultationBook
Archived WordPress fix · Contributed

IP2Location Country Blocker, 2.19.1 fix

One commented-out line that put the archive pages back.

After updating IP2Location Country Blocker to version 2.19.1, every post printed index.php and archive pages stopped showing. I traced it to a debug line in the main plugin file and published the fix.

The patched copy on GitHub All portfolio
On GitHub2019
ip2location-country-blocker.php
The is_backend_page function in ip2location-country-blocker.php, with line 1823, echo $GLOBALS['pagenow'], commented out.

What you are looking at

  • Line 1823: a leftover echo, commented out.
  • Nothing else in the plugin changes.

Screenshot from the original project, April 2022 or earlier.

Open the full-size screenshot

// what-it-does

What it does

A small bug with a loud symptom.

Version 2.19.1 shipped with a debug echo inside is_backend_page(). It printed the current page name into every post, and archive pages stopped rendering.

The fix: open ip2location-country-blocker.php, go to line 1823 and comment the line out by adding // at the start.

ip2location-country-blocker.phpThe whole fix.
// line 1823, before
echo $GLOBALS['pagenow'];

// after
//echo $GLOBALS['pagenow'];

// how-it-was-built

How it was built

A patched copy of one release, published the day I found it.

The plugin belongs to IP2Location. I published the patched copy and the steps for anyone stuck on 2.19.1.

WordPressPHPDebuggingIP2Location
Status

Archived. It only ever applied to version 2.19.1.

Links

branch main 6 active projects ↑ 113 releases portfolio/ip2location-country-blocker-contributed.md Sari --:-- UTC+3:30 its@amirhp.com