Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

79
Views
How to redirect to a specific dynamic url on my page on wordpress

I want the page to be redirected automatically to a specific url.

The url is changing so I guess maybe an anchor function might work.

I am trying to do this on WordPress so a how-to & where-to quick detail will help a lot.

If this is my redirect code

<meta http-equiv="Refresh" content="0; url=Dynamic URL" />

I need the URL content to change automatically to the dynamic link on the page.

The redirection should only happen if the specific dynamic link is found on the page

The website is a blog site on WordPress with multiple categories & the dynamic link can be found in a specific category.

7 months ago · Santiago Gelvez
1 answers
Answer question

0

You should not use html to redirect. Simply add a hook in your functions.php file like this :

add_action( 'init', 'my_redirect' );
 
function my_redirect() {
     if( $my_condition ) {
         wp_redirect($my_dynamic_url);
         // See https://developer.wordpress.org/reference/functions/wp_redirect/
     }
}
7 months ago · Santiago Gelvez Report
Answer question
Find remote jobs