Filters for Pay For Post with WooCommerce

You are here:
← All Topics

wc_pay_per_post_args

This filter allows you to override the WP Query arguments for the shortcodes.

Example:

add_filter('wc_pay_per_post_args', 'my_theme_wc_ppp_args');

function my_theme_wc_ppp_args($args){
    $args['orderby'] = 'menu_order';
    return $args;
}

wc_pay_per_post_purchased_content_title PREMIUM ONLY

This filter allows you to override the title that appears on order confirmation screen an email that lists out the purchased content

Example:

add_filter( 'wc_pay_per_post_purchased_content_title', function () {
	return 'Access your purchased content by clicking links below';
} );

wc_pay_per_post_languages_title PREMIUM ONLY

Only used when POLYLANG plugin support is enabled! This filter allows you to override the title that appears on order confirmation screen an email that normally says “Additional Languages”

Example:

add_filter( 'wc_pay_per_post_languages_title', function () {
	return 'Content is available in the following translations';
} );

wc_pay_per_post_my_account_tab_title PREMIUM ONLY

This filter allows you to override the title of the tab on the My Account page

Example:

add_filter( 'wc_pay_per_post_my_account_tab_title', function () {
	return 'Purchased Videos';
} );

wc_pay_per_post_hide_item_meta_in_email PREMIUM ONLY

This filter allows you to hide the purchased content links in the email receipt ONLY. This is helpful, if you associate many posts with a single product and your order emails get really long.

Example:

add_filter( 'wc_pay_per_post_hide_item_meta_in_email', function () {
	return true;
} );

wc_pay_per_post_enable_javascript_expiration_refresh PREMIUM ONLY

This filter allows you to disable the javascript page refresh when access has expired. This is helpful if you are already integrating your own expiration javascript protection.

Example:

add_filter( 'wc_pay_per_post_enable_javascript_expiration_refresh', function () {
	return false;
} );

wc_pay_per_post_hide_delay_restricted_posts_when_paywall_should_not_be_shown PREMIUM ONLY

If you are using the delay restriction, when using the purchased shortcode, and if the timeframe has not passed yet to show the paywall, users will see any post that has been marked as delay protection that they can actually view as being under Purchased as they have access to it. Some folks might want to change that, if you do, use this filter.

Example:

add_filter( 'wc_pay_per_post_hide_delay_restricted_posts_when_paywall_should_not_be_shown', function () {
	return true;
} );

wc_pay_for_post_show_warnings_position PREMIUM ONLY

If you choose to show the warning box on pageview protected posts, or time based protected posts, this filter will allow you to show the warning box at the TOP of the post content or the BOTTOM of the post content

Example:

add_filter( 'wc_pay_for_post_show_warnings_position', function () {
	return 'BOTTOM';
} );

wc_pay_for_post_allowed_roles PREMIUM ONLY

If you would like to specify a particular user role which would have unlimited access to all protected posts, you can pass in the role to this filter. An example of this would be if you would like all Editors to get full access. MUST return an array.

Example:

add_filter( 'wc_pay_for_post_allowed_roles', function () {
	return array('editor');
} );

wc_pay_per_post_page_view_action_threshold PREMIUM ONLY

If you are using the action wc_pay_per_post_page_view_threshold_reached this filter will allow you to set when you would the action to be fired at. The default is 3
Example:

add_filter( 'wc_pay_per_post_page_view_threshold_reached', function () {
	return 1;
} );

wc_pay_per_post_modify_excerpt PREMIUM ONLY

If you are using the {{excerpt}} smart tag, this filter will allow you to control what that returns on a programatic basis.
Example:

add_filter( 'wc_pay_per_post_modify_excerpt', function () {
	return 'Your Excerpt can go here';
} );

wc_pay_per_post_inline_shortcode_product_link_name PREMIUM ONLY

If you are using the Inline Shortcode and using the {{add_to_cart_link}} smart tag, this filter will allow you to control the name of the link. There is two params, the first is the actual default link title, the second is the product name.
Example:

add_filter('wc_pay_per_post_inline_shortcode_product_link_name', 'update_product_link_name', 2, 10);
function update_product_link_name($link_title, $product_name){
    return 'Please purchase ' . $product_name;
}