- } elseif ( is_404() ) {
- // Add rewrite endpoints if necessary.
- foreach ( $wp_rewrite->endpoints as $endpoint ) {
- if ( $endpoint[2] && false !== get_query_var( $endpoint[2], false ) ) {
- $link = user_trailingslashit( trailingslashit( $link ) . $endpoint[1] );
- }
- }