DocumentationGDPR Cookie ConsentRedirect the “Read More” Link According to the Selected Language Using GDPR Cookie Consent Plugin

Redirect the “Read More” Link According to the Selected Language Using GDPR Cookie Consent Plugin

The GDPR Cookie Consent plugin helps you to make your website comply with the GDPR Cookie Law. The plugin displays a cookie notice bar that allows the users to accept or reject the cookies. The plugin also allows you to link the users to the Privacy Policy page using the Read More link.

Currently, the plugin allows you to provide the link to only a specific privacy policy page. For websites that are viewed in multiple languages, it is desirable that the link is redirected to the privacy policy page of the selected language. The below code snippet allows you to do just that. In the below code, replace the text for the $settings[‘button_x_text’] with the text for the “Read More” link in the selected language and add the URL to the page that the Read More link should redirect to within the ‘if’ condition.

Add the code snippet below to the function.php file of the active child theme to redirect the Read More link to different pages based on the selected language of the website.

  • Was this article helpful ?
  • YesNo