• wp_safe_redirect function in wp-comment-post.php forces a redirect to admin area (or login page) because it considers subdomains as external urls. Needs to add subdomains to allowed_redirect_hosts via add_filter().

    Fixed by adding a code from another plugin (Main categories as subdomains)

    	public function redirect_after_comment( $wp_host , $lp_host ) {
    
    		if ( is_array( $wp_host) ) {
    			$slug = explode( ".", $lp_host );
    			$slug	= $slug[0];
    			if ( get_category_by_slug( $slug ) )
    				$wp_host[] =  $lp_host;
    		}
    		
    		return $wp_host;
    	}

    to the top and then to the place

    foreach ( $subdomain_setting as $v ) {
    			if ( $v == 'category'):

    another filter
    add_filter( 'allowed_redirect_hosts', array( &$this, 'redirect_after_comment') , 10, 2 );
    but if only works for categories. Needs the same for pages and authors. I’m a very lousy coder, if it didn’t work by simply copy, I’d be lost!

  • The topic ‘Redirect to admin area after commenting (semi-fix)’ is closed to new replies.