Most snippets fail with “Cannot use temporary expression in write context”

[ad_1]

Recently this plugin started showing this error for random snippets:

Cannot use temporary expression in write context

The error occurred on line 17 of this snippet’s code (highlighted below).

Please note that it is always the same “…on line 17” error, it doesn’t have anything to do with the context of the code, it will show “on line 17” even if there are fewer than 17 lines.

A good sign that this is being shown incorrectly is that it shown for the “Completely Disable Comments” snippet offered by the plugin.

WP code version: 2.1.12 
WordPress version: 6.5.3
php version: 8.2.16

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer