Support » Plugin: Permalink Manager Lite » will this plugin do this

  • Resolved gnfb

    (@gnfb)


    When the website adds a author he gets a url that directs to his endeavours
    http://mysite.com/user/sam
    what want to happen is that anyone can type in
    http://mysite.com/sam
    and it will go to the http://mysite.com/user/sam location
    The plugin needs to do this in the background for each user author
    if this will do this please show example
    Oh by the way I cannot change the permalink
    /pin/%postname%/
    i am using

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Maciej Bis

    (@mbis)

    Hi @gnfb,

    unfortunately, my plugin does not allow to filter or redirect the author archive URLs. To make it working, you will need a custom solution.

    Could you provide me with more details on the issue you encounter with post permalinks?

    Best regards,
    Maciej

    gnfb

    (@gnfb)

    Thanks for the reply its not so much a problem with your plugin its more finding a solution to my problem of making it so sam can enter his address like this http://mysite.com/sam

    Plugin Author Maciej Bis

    (@mbis)

    Ok, I see. Actually, I no longer do the custom development work for free, but you can use this code to redirect the visitors the way you want:

    function pm_redirect_author_archive() {
    	global $wp_query, $wp;
    
    	// Get the slug
    	if(preg_match('/^([^\/]+)$/i', $wp->request) && !is_author()) {
    		$author = get_user_by('slug', $wp->request);
    
    		if(!empty($author->ID)) {
    			$author_url = get_author_posts_url($author->ID);
    
    			wp_safe_redirect($author_url, 301);
    			exit();
    		}
    	}
    }
    add_action('template_redirect', 'pm_redirect_author_archive');

    You should add the code snippet to the functions.php file in your child theme directory.

    Best regards,
    Maciej

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.