I believe the solution here would be as simple as you’ve generally described it.
Assuming conveniently that $wp_query->query_vars['user']
contains the username and not its ID:
if ( array_key_exists( 'user', $wp_query->query_vars ) ) {
if ( username_exists( $wp_query->query_vars['user'] ) ) {
include( TEMPLATEPATH . '/user-profile.php' );
} else {
include( TEMPLATEPATH . '/404.php' );
}
exit;
}
Related Posts:
- Custom user profile URLs
- How to create a front end user profile with a friendly permalink
- WordPress Rewrite
- Why is there /index.php/ in all my links? How do I remove it?
- WordPress plugin Write User/staff ID as the same as the WordPress User ID
- How to add a user profile page to frontend?
- Attachment page gives 404 if user not logged
- Using a custom 410 page
- Add Link to Users List (Backend) to open each users front-end profile
- Why when I enter bad url wordpress doesn’t return error 404
- 404 redirect based on url
- Showing user profile data on front-end
- Thousands of 404 errors on old posts due to embedded links
- Get logged in username in wordpress url
- Adding Theme File for Non-WordPress Content
- Page not found: Custom search form with a custom search page
- Show index.php template instead of 404 page template
- Redirect empty search to another page
- Custom taxonomy named ‘tag’ return 404 page
- Change author base and slug in author link
- Why is there a 404 on page 2+ for my search page?
- Param causing 404
- Add an ‘edit profile’ page with Genesis
- Error 404 wordpress redirecting URL
- Add dynamic url with external page in WordPress
- add_rewrite_rule is not fired
- Custom Rewrite for Profiles
- Stop wordpress to redirecting home page if no page found
- How can i maintain permalink structure and avoid a 404 error when loading external content?
- 404 for index.php
- User profile in front-end
- How to disable WordPress canonical redirect to nearest matching URL and force 404 Page?
- Unique URL Every Time
- Rewrite default post type
- Rewrite Rules for Multiple (more than 2) Taxonomies
- How can i avoid the permalink start with ‘blog’ while using the custom post type?
- Using plus (+) sign instead of space (-) in WordPress URL
- Google is indexing wordpress attachment pages
- SEO Friendly URLs for my plugin categories
- WordPress keeps writing rewrite rules to .htaccess
- Combine Multiple Categories Into One URL Slug
- Custom rewrite rule for backend/admin?
- Author Profile URL
- Remove all categories from URL
- Add specific word to default page permalink
- Delete user from frontend
- Removing “category” from URLs then “add_endpoint()” won’t work…
- Is it possible to generate an alternate structure for multi-tag urls?
- Use single-site install and map entities to subdomains
- Custom query_vars and parse_request on wp-admin
- Register new user in the frontend
- How do I change attachment slug from name to id
- My WP_options db rewrite_rules Does Not Work
- Rewrite Preview URL to include index.php
- Custom rewrite_rules – only pass numbers and not alphabetic characters
- How to create rewrite endpoints it in author.php?
- Force user to change their password on the frontend at the first login and password policy
- User profile updates password even if not filled (Theme my login) in Firefox? [closed]
- Custom rewrite after the default term link URL
- How can I reduce the number of rewrite rules?
- Create a page that can be used for different URLs
- Capturing /page-name/[0-99999] in both template and number
- custom wordpress rewrite
- Keep requested/entered url with add_rewrite_rule
- Disable WordPress from changing URL slug when post is published
- create front-end users post list by specific category
- Rewrite Rule for homepage not working correctly
- Adding Rewrite URL for Base + Children Separately
- URL rewrite( I think? )
- Make the home page’s slug visible in the browser’s URL bar
- WordPress how to prevent URL encoding in URL of taxonomy terms
- loading images, css and fonts from site url
- how to create user profile pages and display them based on users roles
- How can I add a vanity URL for admin-ajax.php Calls?
- Remove part from dynamic url and redirect
- How to Update / Change URL when Popup Modal Loads?
- How wordpress core include search.php with $_GET[‘s’]?
- Pretty URL via Rewrite
- WordPress numeric (yearly) page names / disable yearly archives
- Routing in WordPress
- Stop wordpress from prettify URL
- Moved WordPress to Subdirectory, still hijacking requests to files outside of its directory
- Showing extra profile fields in admin – problem with underscore
- Rewrite URL query string for all pages
- Let user delete comment on front end only
- ModRewrite not working properly
- Need help with custom rewrite rule
- Relative URL filtering
- get_permalink is getting old rewrite rule
- Rewriting URL does not automatically log me in
- How to create a link to a user’s profile page
- Storing additional information about the user
- Pagination posts. Url format
- How to prevent URL-modification when page title contains digits only?
- WordPress Post url encoding problem
- What techniques can a user employ to achieve a password rated “strong” in the WordPress password checker
- Cant edit profile from frontend
- Programmatically add a custom url route “/category/index.json” to return a collection of posts in json
- WP-Include rewrite directory
- WordPress is adding pagination for all pages like www.example.com/page/123. How to remove that?