PPWP Pro Hooks, REST APIs, & Public Functions

Since version 1.3, Password Protect WordPress Pro provides RESTful APIs and public functions to achieve the following:

PPWP public action & filter hook

CategoryHookTypeAvailable on
Individual Protection
ppwp_qal_single_allowed_pagefilterPro
Partial Protection
ppwp_qal_pcp_allowed_pagefilterPro
Sitewide Protection
ppw_custom_header_form_entire_siteactionFree
ppw_custom_footer_form_entire_siteactionFree
ppwp_sitewide_headactionPro
ppwp_sitewide_footeractionPro
ppwp_sitewide_error_messagefilterPro

Where are sitewide passwords stored?

PPWP Free and Pro store sitewide passwords under wp_options table:

  • PPWP Free’s option name is wp_protect_password_set_password_options
  • PPWP Pro’s option name is ppw_entire_site_options

With PPWP Suite extension, we migrate sitewide passwords to our own wp_pda_passwords table for extended features management.

Change Shortcode Passwords Conditionally

Use the following hook to filter passwords shortcode attribute when protecting partial content.

add_filter( 'ppw_shortcode_passwords', 'ppw_filter_shortcode_passwords' );
/**
 * Filter PPWP Passwords.
 * 
 * @param array $passwords Array shortcode passwords.
 * 
 * @return array
 */
function ppw_filter_shortcode_passwords( $passwords ) {
	// Filter array passwords.
	return $passwords;
}

Hide “Password Protection” column

There are 3 ways to hide our “Password Protection” column in the Pages or Posts dashboard.

Option 1: Untick that column in the Screen Options.

Option 2: Use the Admin Columns plugin.

Option 3: Add the following custom codes to your (child) theme’s functions.php file.

For PPWP Free version

$post_types = array( 
			'posts', 
			'pages', ); 
		foreach ( $post_types as $post_type ) { 
			add_filter( "manage_${post_type}_posts_columns", function ( $columns ) { 
				unset( $columns['ppw_password_protection'] ); 
				return $columns; }, 99 ); }

For PPWP Pro version

$post_types = array( 
			'posts', 
			'pages', 
			'your-custom-post-type' ); 
		foreach ( $post_types as $post_type ) { 
			add_filter( "manage_${post_type}_columns", function ( $columns ) { 
				unset( $columns['pda_password_protection'] ); 
				return $columns; }, 99 ); }

Remove ?ppwp=1 query string

Once users enter the right password, our plugin will add ?ppwp=1 query string to the page URL for tracking purposes. This doesn’t affect your site whatsoever.

However, if you want to remove the query string for some reason, simply add the following codes to your (child) theme’s functions.php file.

add_filter('ppwp_ppf_redirect_url_before_return_content', function ($url) {
    $url = add_query_arg('ppwp', null);
    return $url;
});
Lasted updated on February 25, 2021