Answers for "url redirect wordpress"

PHP
1

wp_redirect to home page

function redirect_to_home() {
  if(!is_admin() && is_page('2')) {
    wp_redirect(home_url());
    exit();
  }
}
add_action('template_redirect', 'redirect_to_home');
Posted by: Guest on October-02-2020
0

wordpress redirect all pages to new domain htaccess

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]
</IfModule>
Posted by: Guest on April-21-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 "url redirect wordpress"

Browse Popular Code Answers by Language