Password CSV Importer and Exporter

Password Suite extension allows you to import hundreds of passwords from an uploaded CSV file. It will add passwords with basic information, including password type, usage limit, and password expiry.

In this article, we will show you how to import and export passwords to and from your website using Password Suite.

Requirements:

Import Passwords

In order to import passwords, you need a CSV file containing your password information.

Create a CSV file

Here are 2 sample CSV file templates to help you get started.

For Individual Passwords

  • password (required): unique, no space, case-sensitive, and limited to 100 characters
  • post_id (required): which post will be protected by these passwords. You can get the ID number by hovering over the desired post title.
  • type (required)
    • Auto: everyone can use this password.
    • Role_x (e.g. Role_administrator; Role_editor): only specific user roles can use this password. Multiple roles are separated by a semicolon (;).
  • label: extra information for your password, e.g. what it is used for
  • is_activated
    • 1 if this password is active
    • 0 if this password is inactive
  • expired_date (integer) the number of days after being imported this password will expire. It must be a positive number.
  • usage_limit (integer) the maximum number of times this password can be used. It must be a positive number.

Since PPWP Password Suite version 1.3.8, you can import or export Individual passwords with expiration time after the first use (Smart Restriction extension version 1.1.3 or greater is required).

  • expiration_click:
    • 1: set password expiration time after the first use
    • 0: set password expiration time based on “expired_date”
  • expired_after (integer): the number of seconds that the password will expire after the first use.

For Sitewide Passwords

  • password (required): unique, no space, case-sensitive, and limited to 100 characters
  • label: extra information for your password, e.g. what it is used for
  • is_activated
    • 1 if this password is active
    • 0 if this password is inactive
  • expired_date (integer) the number of days after being imported this password will expire. It must be a positive number.
  • usage_limit (integer) the maximum number of times this password can be used. It must be a positive number.
  • redirect_url: where users will be redirected once entering this password.

For Master Passwords

  • password (required): unique, no space, case-sensitive, and limited to 100 characters.
  • post_types (required): which post types this password will be applied to. You need to input valid values. Multiple post types are separated by a semicolon (;)
    • page
    • post
    • Custom Post Types (CPTs) slug such as product
  • protection_types (required): which type of protection this password will be applied to. Multiple types are separated by a semicolon (;)
    • single: Individual Protection
    • pcp: Partial Content Protection
  • type
    • master_global: everyone can use this password
    • master_role_x: (e.g. master_role_administrator; master_role_editor): only specific user roles can use this password. Multiple roles are separated by a semicolon (;).
  • is_activated
    • 1 if this password is active
    • 0 if this password is inactive
  • label: extra information of your password, e.g. what it is used for
  • expired_date (integer) the number of days after being imported this password will expire. It must be a positive number.
  • usage_limit (integer) the maximum number of times this password can be used. It must be a positive number.

Import process

After activating our plugins, navigate to Password Protect WordPress >> Import & Export sub-menu from your admin dashboard.

Select a CSV file from your local and click on the “Start Import” button.

 

You can select the import type, either adding new passwords or updating the existing ones.

Please note that passwords that have the wrong format or miss required information will be skipped during the import process.

Increase password limit

Our plugin allows you to import up to 10.000 passwords at once. To increase this default value, simply add the following code snippet into your (child) theme functions.php file.

add_filter(
	'ppwp_ps_import_max_lines',
	function ($max_lines) {
		return 30000;
	},
	10,
	1
);

Increase execution timeout

If you increase the maximum number of imported passwords, you might need to increase the default execution timeout too. The longer the timeout duration is, the more passwords imported. To do so, add the following code snippet to your (child) theme functions.php file.

add_filter(
	'ppwp_ps_http_client_timeout',
	function ($timeout) {
		return 30000; /*30 seconds*/
	},
	10,
	1
);

Export passwords & quick access links

You can also export all existing passwords and quick access links to a CSV file, including:

  • Passwords of individual content
  • Sitewide passwords
  • Master passwords
  • Shortcode global passwords (WIP)

Under Import & Export Password dashboard, switch to Export tab and select which passwords and information to export.

 

 

Column Property Notes
Post ID post_id ID of a password protected content
Post title post_title Title of a password protected content
Password password Password used to unlock a protected content
Quick access link access_link Link used to access the content directly without entering a password
Label label Extra information for a specific password
Type type
  • Auto if everyone can use the password
  • Role_x (e.g. Role_administrator; Role_editor) if only specific user roles can use the password. Multiple roles are separated by a semicolon (;)
Is activated is_activated
  • 1 if the password is active
  • 0 if the password is inactive
Usage usage The number of times the password has been inputted
Usage limit usage The maximum number of times the password can be used
Created date created_date The date and time the password has been created
Expiration date expired_date The number of days after export the password will expire
Is expired at first use expiration_click
  • 1 if the “password expiration after the first use function” is enabled
  • 0 if the “password expiration after the first use” function is disabled
Expiry after first use expired_after The number of seconds that passwords will expire after the first use.

Simply click on the “Export” button, you will be prompted to store the generated CSV in your local.

Note: If you have thousands of passwords, it is recommended to export data for each post instead of all posts at once.

Lasted updated on May 18, 2022