Answers for "how to redirect to a soecific url in wordpress"

PHP
6

redirect wordpress

add_action( 'template_redirect', 'redirect_to_other_page' );
function redirect_to_other_page() {
    if ( is_page( 143 ) ) {
	  
      wp_redirect( '"'.home_url().'/services/messenger/"', 301 );
      ///wp_redirect( 'example.com/page', 301 ); 
    exit;
    }
}
Posted by: Guest on April-12-2021
0

wp php redirect my account page url to custom url

function custom_redirect() {
    global $wp;

    if( $wp->request == 'my-account' ) {
        wp_redirect( site_url( 'my-account/orders/' ) );
        exit;
    }
}

add_action ('template_redirect', 'custom_redirect');
Posted by: Guest on October-18-2021

Code answers related to "how to redirect to a soecific url in wordpress"

Browse Popular Code Answers by Language