After making an update to one of my WordPress plugins, when trying to load plugin settings page, I get the following error message:

Fatal error: Can’t use function return value in write context in /public_html/ on line 19

For WordPress users, I recommend reading another article about this error.

What causes this error

This error message is self explanatory. It means that we are trying to use function to return value in write context. It also tells us where exactly this error occurred. To solve this issue, follow the steps below.

How to solve it

  1. Open the file that is mentioned in the error message. In my case this is the functional.php file, which is placed in the /public_html/ directory.

  2. Find the line specified in the error message. In my case this is the 19th line.

  3. Here you can see the code that causes the error. That’s how it looks in my case:

if ( ! empty( get_option( 'my_option' ) ) {

Note! You can see something similar to this but with isset() or another PHP function, and with custom function instead of WordPress function get_option(). For example:

if ( ! empty( myFunction( $myVariable ) ) {


if ( isset( $_POST( 'my_option' ) == TRUE ) ) {

All I had to do to solve this error was to change the code above to the following:

if ( ! get_option( 'my_option' ) )

This code does exactly the same thing but in more elegant way. Also we can make a variable and then use it in the our if construction:

$my_option = get_option( 'my_option' );
if ( ! empty( $my_option ) {


That’s it, you’re done. Now your plugin should work without this error. So simple isn’t it?

If you are having trouble fixing this problem with the instructions above, but are being able to solve this problem with any another method please describe it in the comment section below. Thanks!

If this article has helped you solve the problem then please leave a comment :smiley:

Thanks for reading!