Support » Plugin: WP User Manager - User Profile Builder & Membership » Redirect /author to /profile fails and goes to shopsite

  • Resolved arunha



    I want to use this plugin to show post authors information.
    The posts are used for custom entries which users can create on a restricted subsite.
    When clicking on the post authors name, it goes to /author/nickname but I want it to go to the plugins url which is /profile/nickname.

    Therefore, I have written some code into my child theme’s functions.php:

    //redirect /author to /profile
    function author_redirect() {
      $url = urldecode($_SERVER['REQUEST_URI']);
    		if( strpos($url, '/author/' ) !== false) {
          $profile = substr($url, strrpos($url, '/') + 1);
    			wp_redirect( site_url( '/profile/' . $profile), 301 );
    add_action('template_redirect', 'author_redirect');

    That works if the user isn’t existing, e.g. /author/example redirects to /profile/example
    If the user exists though, it redirects to the shop (woocommerce) site.
    I looked through a lot of plugins (wpseo, wp security, wpml, woocommerce etc) but I can’t get it to work.
    Do you know any workaround? I didn’t find a setting in wp user manager to redirect correctly.

    Thanks in advance

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Redirect /author to /profile fails and goes to shopsite’ is closed to new replies.