WordPress asking for FTP credentials

If you’re asked to enter your FTP credentials when you try to install or update a plugin or theme in the WordPress dashboard, it’s because of a specific setting in the wp-config.php file. Follow the steps below to prevent WordPress from displaying this FTP prompt.

  1. Find the folder with your WordPress files and open the wp-config.php file.
  2. At the bottom of the wp-config.php file, above the line that says 
    /* That's all, stop editing! Happy publishing. */,
    add the following lines of code:
define('FS_METHOD', 'direct');