Hooks & Filter

Passster provides a lot of useful filters and actions to modify the behavior of the plugin. This docs section is dedicated to developers, so expect a lot of code to read.

Action Hooks

passster_validation_success

This is an action hook that contains the password that was used to successfully unlock a password-protected area. It’s useful to implement basic tracking or other actions based on the used password.

add_action('passster_validation_success', function( $password) {
// Do something with the password.
});

passster_validation_success_list

This is an enhancement to the action above which is specific to the usage of password lists. It provides the password, the list which contains the password, and the post ID of the unlocked post.

add_action('passster_validation_success_list', function( $password_list_id ){
// Do something with the password list id.
});

Filter Hooks

passster_disable_base_encryption

You may want to disable the encryption of passwords for specific reasons. This filter can be used as a toggle to deactivate the encryption within cookies, AJAX validation, and server-side processing.

add_filter('passster_disable_base_encryption', '__return_true' );

passster_compatibility_actions

This filter provides ways to further customize the protected content. You may have some kind of special shortcode or rendering method that needs to happen before the content gets unlocked. It’s also used internally to provide support for most page builders and other third-party plugins with the Ajax functionality of Passster.

add_filter('passster_compatiblity_actions', function( $content, $post_id ){
// Replace shortcodes, add additional logic.
});

passster_password_form

You can overwrite the template that is being used in the frontend with your own. You will find all available templates within /wp-content/plugins/content-protector/src/templates. Copy and paste them into your child theme and use the following code snippet to load your own template instead of the provided one:

add_filter( 'passster_password_form', function ( $template_path ) {
	$template_path = get_stylesheet_directory() . '/templates/password-form.php';

	return $template_path;
} );