Code Snippets

PHP Current Directory

How to get current directory, filename and code line number in PHP

Clarity TLDR: Use __DIR__ for the current script’s directory, basename(__FILE__) for the current filename, and __LINE__ for the current line number. The older dirname(__FILE__) form still works, but __DIR__ is the modern equivalent. Examples of each below. In PHP, there are several built-in functions that can be used to obtain information about the current script’s

How to get current directory, filename and code line number in PHP Read More »

PHP error log - operator not supported

[] operator not supported for strings – PHP

I had a problem with Revolution Slider on a WordPress installation when upgrading to PHP 7.2+. It would generate the error – PHP Fatal error: [] operator not supported for strings in C:[path]\wp-content\plugins\revslider\includes\framework\base-admin.class.php:71 The problem was from the plugin attempting to use the short array push syntax on a string: The solution was to modify

[] operator not supported for strings – PHP Read More »

Cookies Blocked or Not Supported - Wordpress

Troubleshooting WordPress: Cookies Blocked or Not Supported – Updated for 2025

Are you stuck in a frustrating login loop with WordPress Multisite? If you’re seeing the error message: “Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress,” don’t worry—you’re not alone. This issue often arises due to domain mapping in Multisite installations. Here are some effective solutions to get

Troubleshooting WordPress: Cookies Blocked or Not Supported – Updated for 2025 Read More »