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

    Thread Starter 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)

The topic ‘will this plugin do this’ is closed to new replies.