View Categories

Reading Time: 1 min read

Learn How to Set a Constant FS_Method #

Learn How to Set a Constant FS_Method, Occasionally, WordPress may ask for your FTP credentials when you attempt to install or update the rollback Rank Math.

This happens because your site is set up with a filesystem that stops direct file modifications from the WordPress dashboard.

Learn How to Set a Constant FS_Method

In the WordPress dashboard’s plugins section, you can enter your FTP credentials and click Proceed. 

WordPress will then begin the installation process. You will also see this window when updating the plugin. 

If you don’t have FTP access, you can use the direct method. 

This article will guide you on how to change the FS_METHOD constant to bypass this prompt window during the installation/updating of Rank Math.

First, let’s understand what FS Method is.

Learn How to Set a Constant FS_Method, Understanding FS_Method #

FS_METHOD is a WordPress constant that defines how WordPress should write to the filesystem. 

WordPress initially attempts the Direct method, which writes files directly to the filesystem. 

This method is highly efficient, but if your server doesn’t support direct file writes, WordPress will switch to the FTP method automatically. 

FS_METHOD determines which method WordPress should use:

  1. direct
  2. ssh2
  3. ftpext
  4. ftpsocket

How does altering the FS_METHOD impact my server? #

Changing the FS_METHOD won’t negatively affect your server. However, if you modify the constant to something else, you’ll need to provide FTP credentials for WordPress to work properly. 

How to Set the FS_METHOD: Learn How to Set a Constant FS_Method #

Follow these steps to set the FS_METHOD. 

Open wp-config.php File #

First, open the wp-config.php file in your website’s file manager. You can access it using FTP or cPanel File Manager. 

Add/Update FS_METHOD #

In the wp-config.php file, check if FS_METHOD is already defined. If not, add the following code:

If it is defined, update the FS_METHOD constant to direct, as shown below.

define( ‘FS_METHOD’, ‘direct’ );

Save/Upload the File #

Finally, save the file (for cPanel File Manager) or upload it (for FTP) to apply the changes to your website. 

Note: If you cannot access the wp-config.php file, contact your web host to add the FS_METHOD.

That’s it – a step-by-step guide on changing the FS_METHOD constant. We hope this guide was helpful.