admin管理员组

文章数量:1287581

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 3 years ago.

Improve this question

I can change the translatable area of terms and conditions or privacy policy area but didn't find any way to change the "privacy policy" and "terms and conditions" text of the link.

For example, the text is:
I have read and agree to the website terms and conditions I can change the bold area from customizer> woocommerce section. but there is no way to change "terms and conditions". is there any way to change that text?

Thanks

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 3 years ago.

Improve this question

I can change the translatable area of terms and conditions or privacy policy area but didn't find any way to change the "privacy policy" and "terms and conditions" text of the link.

For example, the text is:
I have read and agree to the website terms and conditions I can change the bold area from customizer> woocommerce section. but there is no way to change "terms and conditions". is there any way to change that text?

Thanks

Share Improve this question asked Oct 4, 2021 at 11:55 Emtiaz ZahidEmtiaz Zahid 1035 bronze badges 4
  • This is a third party plugin support question, and should be directed to their support forum: wordpress/support/plugin/woocommerce – Jacob Peattie Commented Oct 4, 2021 at 12:01
  • my bad. actually my first question here. should I remove this and post it to plugin support or wait for someone for help? – Emtiaz Zahid Commented Oct 4, 2021 at 12:04
  • 1 Post it to plugin support. Third party plugins are off topic here. – Jacob Peattie Commented Oct 4, 2021 at 12:06
  • the privacy policy shortcode may be the standard privacy policy text from WP Core settings, but you should contact WooCommerce support or as in one of their communities, 3rd party plugin support is offtopic here – Tom J Nowell Commented Oct 4, 2021 at 13:08
Add a comment  | 

1 Answer 1

Reset to default 1

After some digging in WooCommerce github and WordPress github I can say that there isn't a filter, in WooCommerce, to change that specific text.
What you can do is hook into pre_kses, because that what WooCommerce uses to handle the output and look for privacy policy, change it to what ever you want and you are ready.
Problem is that it will affect all other privacy policy texts that use the same function so do some tests before you go live with this.
Same goes for "terms and conditions" text.

add_filter('pre_kses', 'bt_change_policy_and_conditions_texts');
function bt_change_policy_and_conditions_texts ($string) {
    if (strpos($string, 'privacy policy') !== false) {
        // change 'Something else' to what ever you need
        return str_replace('privacy policy', 'Something else', $string);
    }
    
    if (strpos($string, 'terms and conditions') !== false) {
        // change 'Something else 2' to what ever you need
        return str_replace('terms and conditions', 'Something else 2', $string);
    }
    
    return $string;
}

This goes into functions.php.

本文标签: How to change woocommerce checkout privacy policyterms and condition text