WordPress.org

Ready to get started?Download WordPress

Forums

Display Name Author Permalink
[resolved] Solution: Redirecting to a page rather than including 404. (2 posts)

  1. Dominor Novus
    Member
    Posted 2 years ago #

    If a user tries to access the profile page using an existing log-in name, a 404 (error) is presented.

    It may be just on my end but the 404 template is placed above the profile page i.e. if I scroll down.

    Instead, it's possible to just redirect the user a specific page of your choice should you wish/need.

    Edit:

    display-name-author-permalink/display-name-author-permalink.php

    Find:

    // redirect template to use 404 template
    	function redirect_404() {
    		include(get_404_template());
    		return;
    	}

    Replace with:

    // redirect template to use 404 template
    	function redirect_404() {
    		//include(get_404_template());
    		//return;
                    wp_redirect( "http://www.yourwebsite/yourpage" );
    	}

    http://wordpress.org/extend/plugins/display-name-author-permalink/

  2. Dominor Novus
    Member
    Posted 2 years ago #

    You could also pass a variable via the URL to trigger an error message on the intended page:

    wp_redirect( "http://www.yourwebsite/yourpage?error=yes" );

    You can use PHP's GET function to grab the variable and use a condition to determine whether or not the error message is displayed.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic