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?
- custom user profiles like linktree fully customizable on the front end
- get parameter from url rewrite [closed]
- Disable editing profile for second time
- How to change search url produced by ‘s GET method?
- Generated URLs don’t reflect accurate URLs.
- WordPress Post url encoding problem
- How to create User friendly URL in WordPress?
- How to make wordpress backend mobile optimized.?
- What techniques can a user employ to achieve a password rated “strong” in the WordPress password checker
- Hide / rewrite download link
- wordpress url rewrite Query Var to Static url
- how to rewrite folder name in url to another name
- Please give me the rewrite rules for my ugly urls
- Lost WordPress website access after changing URL [closed]
- How do I change my WordPress website’s address or URL?
- Add rewrite endpoint and .htaccess
- Remove url parameter using wordpress
- How to stop WordPress from replacing plus (+) characters from URL on the front page?
- Use add_rewrite_rule to change subpage url
- Change the slug ( url ) to a sequence number starting from 0 in the custom record type?
- How to add unique auto-increment number on url before slug
- Wrong rewrite rules
- Spurious URL structure (Adding extra /0/s)
- Need help with regex
- Rewrite Page Parameters
- How to make custom WordPress page deliver search results
- URI rewriting: handling one page
- Rewrite and replace url wp-admin/edit.php and wp-admin/post-new.php
- Cant edit profile from frontend
- Programmatically add a custom url route “/category/index.json” to return a collection of posts in json
- Rewrite rule to simulate page hierarchy results in 404
- Rewrite URLs in a Custom Post Type with Multiple Taxonomies
- Rewrite rule giving 404 error
- Some data of one custom user profile is erased when I update another custom user profile
- Using .htaccess to redirect /da/ to / in URL
- add_rewrite_rule not working with custom variables
- WordPress picks a wrong template if ?cat= is used as URL parameter
- WP-Include rewrite directory
- add_rewrite_rule doesn’t work when trying to add a new parameter at the end of URL
- Change url site.it/wordpress
- Post pages are redirecting to the 404 page in wordpress
- Problems Implementing Non-WordPress Rewrite Rules
- Standard Regex syntax doesn’t work in WordPress rewrite rule
- WordPress is adding pagination for all pages like www.example.com/page/123. How to remove that?
- How can I add_rewrite_rule for a custom post type to preserve the referral id
- Can we get user profile page using user_id in the URL?
- Issues with creating user profile for a subscriber, but with different profile page and functionalities
- How to combine nearly identical custom rewrite rules for WordPress
- Force Profile link for username, and stop “Website” field on Profile from becoming offsite link atop Comments, in “Recent Comments” list, etc
- Is it possible to use the same slug structure for a taxonomy and for some pages?
- How to keep rewrite_rule without flushing each time?
- WordPress fallback rewrite
- rewrite for subpage seems to loose parameter
- Redirect all URLs in WordPress and Permalink to by country to subdomain
- How to make such a structure for cpt?
- How to customize the url structure?
- `query_var` values empty in theme file after `add_rewrite_rule` redirection
- Is there a way to add a ACF/metadata field data to a custom post type permalink?
- get_query_var return false
- Is there a way to use rewrite rules in WordPress to correctly render a page or post?
- URL rewriting problem
- Preserve the url for subpage
- Nesting add_rewrite_rule() with custom page and subcategories
- openlitespeed rewrite rules conversion from apache
- Allow requests to resources outside the wordpress folder
- make_clickable and parenthesis breaks the URL
- How to write ReWrite Rule to cut URL?
- WordPress pagination error when using ACF CPT rewrite slug & Polylang CPT slug translation