Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter buckrogers

    (@buckrogers)

    Great thanks! This worked for me.

    Thread Starter buckrogers

    (@buckrogers)

    Did you figure this out? It will be very helpful if you explain how you did it. I have a similar setup that translate /statelist to index.php?page_id=1137&input1=statelist in my .htaccess file. I then have dynamic code in my template page.php that generates the content.

    How do I get rid of the original permalink for page_id=1137?

    Thanks
    Chris

    Thread Starter buckrogers

    (@buckrogers)

    Yes, but it’s not a nice solution. I didn’t have time to figure out how the permalink functions work. Or I couldn’t figure it out after a week of late nights. I just needed this for one page ID. I changed it in wp-includes/canonical.php. I added one line to ignore the function for my page ID. A better way is to use a custom field if you have multiple pages you want this for:

    if ( $do_redirect ) {
    		//CHR this line will exclude permalink translation for a single page
                      //Use it to call a page with dynamic page generation code
    	    if ( get_query_var('page_id') == "1137" ) return false;
    		// CHR end modification for 31 directory
    
    		// protect against chained redirects
    		if ( !redirect_canonical($redirect_url, false) ) {
    			wp_redirect($redirect_url, 301);
    			exit();
    		} else {
    			// Debug
    			// die("1: $redirect_url<br />2: " . redirect_canonical( $redirect_url, false ) );
    			return false;
    		}
    	} else {
    		return $redirect_url;
    	}

    Remember to make a backup copy after the change. The next WordPress upgrade will overwrite this.

Viewing 3 replies - 1 through 3 (of 3 total)