How Can We Help?

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_shortcode_has_access_no_posts

This filter allows you to override the text “You have not have access to any protected posts.” in the Has Access shortcode

Example:

add_filter('wc_pay_per_post_shortcode_has_access_no_posts', 'my_theme_wc_pay_per_post_shortcode_has_access_no_posts');

function my_theme_wc_pay_per_post_shortcode_has_access_no_posts(){
    return 'Your New Title';
}

wc_pay_per_post_shortcode_purchased_no_posts

This filter allows you to override the text “You have not purchased any protected posts.” in the Has Access shortcode

Example:

add_filter('wc_pay_per_post_shortcode_purchased_no_posts', 'my_theme_wc_pay_per_post_shortcode_has_access_no_posts');

function my_theme_wc_pay_per_post_shortcode_has_access_no_posts(){
    return 'Your New Title';
}

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_allowed_roles_for_meta_box PREMIUM ONLY

If you would like to restrict the meta box from showing up for a particular user role you can use this filter. For instance if you do not want authors to be able to see the meta box, you would do the following. MUST return an array.

Example:

add_filter( 'wc_pay_per_post_allowed_roles_for_meta_box', function () {
	return array('author');
} );

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;
}

wc_pay_per_post_my_account_show_has_access PREMIUM ONLY

If you are using the WooCommerce My Account Tab integration, by default it will show both the purchased content shortcode AND the has_access shortcode. If you would like to NOT show the has_access section use this filter.
Example:

add_filter('wc_pay_per_post_my_account_show_has_access', '__return_false');

wc_pay_per_post_my_account_show_purchased PREMIUM ONLY

If you are using the WooCommerce My Account Tab integration, by default it will show both the purchased content shortcode AND the has_access shortcode. If you would like to NOT show the purchased section use this filter.
Example:

add_filter('wc_pay_per_post_my_account_show_purchased', '__return_false');

wc_pay_per_post_my_account_has_access_title PREMIUM ONLY

If you are using the WooCommerce My Account Tab integration, by default the title of the has access section is ‘Content you have access to’, use this filter to change that to whatever you would like.
Example:

add_filter('wc_pay_per_post_my_account_has_access_title', 'change_has_access_title');
function change_has_access_title(){
     return 'WHATEVER YOU WOULD LIKE THE TITLE TO BE';
}

wc_pay_per_post_my_account_purchased_title PREMIUM ONLY

If you are using the WooCommerce My Account Tab integration, by default the title of the has access section is ‘Content purchased’, use this filter to change that to whatever you would like.
Example:

add_filter('wc_pay_per_post_my_account_purchased_title', 'change_purchased_title');
function change_purchased_title(){
     return 'WHATEVER YOU WOULD LIKE THE TITLE TO BE';
}