Title: Fatal error in admin login, undefined function create_function
Last modified: January 16, 2024

---

# Fatal error in admin login, undefined function create_function

 *  Resolved [istrate678](https://wordpress.org/support/users/istrate678/)
 * (@istrate678)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-in-admin-login-undefined-function-create_function/)
 * Hi, I’m new so please be patient with me. I noticed yesterday I can no longer
   log into the admin area of my site, it gives fatal error. The site itself for
   visitors is still up and working.
 * I used phpMyAdmin to disable all plugins and set a standard theme, which worked
   fine but didn’t change a thing about the login error. I also never received the
   email I was supposed to get for the error message. After the error message and
   just going to my publicly visible site I can even see the bar where I could access
   my dashboard and profile, but when I clock on anything there I get the fatal 
   error again.
 *  I then enabled debug and got this:
 * Fatal error: Uncaught Error: Call to undefined function create_function() in /
   mnt/web206/c2/26/53922126/htdocs/WordPress_02/wp-config.php:90 Stack trace: #
   0 /mnt/web206/c2/26/53922126/htdocs/WordPress_02/wp-load.php(50): require_once()#
   1 /mnt/web206/c2/26/53922126/htdocs/WordPress_02/wp-admin/admin.php(34): require_once(‘…’)#
   2 /mnt/web206/c2/26/53922126/htdocs/WordPress_02/wp-admin/index.php(10): require_once(‘…’)#
   3 {main} thrown in /mnt/web206/c2/26/53922126/htdocs/WordPress_02/wp-config.php
   on line 90
 * I have found out already that create_function is something that has to do with
   stuff that is no longer supported with newer php versions (I use 8.1 now and 
   can only go back to 8.0 which doesn’t fix the problem. It’s possible the problem
   existed for longer but I had no reason to go into the backend for a while), but
   I have no idea what to do about it.
 * I’m also a total amateur so I’d need possible explications in non-programmer 
   speech, thank you.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffatal-error-in-admin-login-undefined-function-create_function%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Anonymous User
 * (@anonymized-20801613)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-in-admin-login-undefined-function-create_function/#post-17346957)
 * **ChatGPT:**
 * It looks like the error is related to the use of the `create_function` function,
   which is deprecated in PHP 7.2 and removed in PHP 8.0. To fix this issue, you
   need to locate and modify the code that uses `create_function` in your WordPress
   installation.
 * In your case, the error is occurring in the `wp-config.php` file on line 90. 
   Unfortunately, I can’t directly access your website’s files, but I can guide 
   you on how to fix it.
    1. **Access Your WordPress Files:** You will need to access your WordPress files.
       This can be done using an FTP client or through your hosting provider’s file
       manager.
    2. **Edit wp-config.php:** Open the `wp-config.php` file using a text editor. Look
       for the line that contains the `create_function` function. It might look something
       like this:
 *     ```wp-block-code
       create_function('$args', '...');
       ```
   
 * or
 *     ```wp-block-code
       add_action('some_hook', create_function('$args', '...'));
       ```
   
 * **Replace create_function:** Replace the `create_function` code with an alternative
   approach using an anonymous function (closure). For example:
 *     ```wp-block-code
       // Old code
       // create_function('$args', '...');
   
       // New code
       add_action('some_hook', function($args) {
           // ...
       });
       ```
   
    1. Replace the appropriate part of the code based on your specific usage. If you’re
       unsure, you can provide the code around line 90 of `wp-config.php`, and I can
       help you with the modification.
    2. **Save and Upload:** Save the changes to the `wp-config.php` file and upload
       it back to your server.
 * After making these changes, check if the admin login issue persists. If you encounter
   any difficulties or if the error is in a different file, feel free to provide
   more details or ask for further assistance.
 *  Thread Starter [istrate678](https://wordpress.org/support/users/istrate678/)
 * (@istrate678)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-in-admin-login-undefined-function-create_function/#post-17347021)
 * Thank you. I tried but it doesn’t work. I’m not sure exactly which parantheses
   and quotes I need to keep in the syntax, I probably messed it up there so I reverted
   it back to the original.
 * This is what it says:
 * if(is_admin()) {
   add_filter(‘filesystem_method’, create_function(‘$a’, ‘return“
   direct”;’ ));
 *  Thread Starter [istrate678](https://wordpress.org/support/users/istrate678/)
 * (@istrate678)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-in-admin-login-undefined-function-create_function/#post-17347358)
 * I finally found a solution in older posts, leaving this here in case someone 
   else comes across the same issue: The above quoted line is not part of wordpress
   core, must have been added by a plugin or something else, even if disabling plugins
   didn’t resolve my issue.
 * After making a copy of the wp-config.php as backup, I simply deleted the above
   mentioned piece of code with the create_function and can now log into my backend
   again.
 *  [Edward C Sproull](https://wordpress.org/support/users/ecsproull/)
 * (@ecsproull)
 * [2 years ago](https://wordpress.org/support/topic/fatal-error-in-admin-login-undefined-function-create_function/#post-17768941)
 * If you actually want to fix the error replace:
 * add_filter(‘filesystem_method’, create_function(‘$a’, ‘return “direct”;’ ));
 * With: add_filter( ‘filesystem_method’, function( $a ) { return “direct”; } );

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Fatal error in admin login, undefined function create_function’ is closed
to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [Edward C Sproull](https://wordpress.org/support/users/ecsproull/)
 * Last activity: [2 years ago](https://wordpress.org/support/topic/fatal-error-in-admin-login-undefined-function-create_function/#post-17768941)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
