From what I understand you are trying to change the permalink structure of the user, so instead of showing yoursite.com/author/yourusername it will show yoursite/profile/yourusername?
You can add a rewrite rule to the permalink structure to make that change:
function yourdomain_user_rewrite() {
global $wp_rewrite;
$wp_rewrite->author_base="profile";
$wp_rewrite->author_structure="https://wordpress.stackexchange.com/" . $wp_rewrite->author_base . '/%author%';
}
add_action( 'init', 'yourdomain_user_rewrite' );
Then Worpdress will automatically load author.php on your theme when yoursite/profile/XXXX is queried. No complicated queries involved!
Is that what you are looking for?
Related Posts:
- Getting all user metadata from user
- How to add custom query filters in WP_User_Query
- Add a default meta_value to new posts
- Filter user list that meta_value is empty
- Query wp_usermeta alongside wp_users
- SQL User Query by Multiple Roles using PHP
- WP User Query get all authors with last name starting with specific letter
- Sort users by “birthday” using WP_User_Query
- Hide Administrators From User List except current user (administrator)
- How to display user order by role
- Import wp users via one click demo option
- Dynamic User Id
- Prevent author bio page from showing in search results
- Get multiple users with meta value in one query and populate WP_User class
- Reduce number of SQL queries inside WP_Query loop to fetch author data
- Display if author page is author page of current user
- Get user first name from custom endpoint
- Storing an array of objects related to each user
- Query to get last posts from authors of blog
- Deleting terms from the WordPress wp terms table
- Query pages created by deleted users
- Query posts by post type, author and post meta
- Random users always showing same 8 users
- wp_set_object_terms() custom taxonomy not working correctly when using insert post
- Set “editor” role to existing user
- wp_insert_post with ACF Fields and WP Meta Query returns no rows until update
- How to query 5 users in random who have published more than 10 posts
- How to query users by post count no less than 10
- Merge wp-query and get_users
- Get all wp_users sort by metakey
- Logging search queries for logged-in users
- List users by Year of Birth using a foreach loop to dynamically populate years and data
- Show subscriber id in loop
- Wrote a WP Cron Plugin and it triggers a fatal error upon activation
- Query Users by post count, last 30 days and display each users post count according to post type
- Get users query makes the site loading time too big?
- Get all user with both meta_value
- Group users by meta field, with name of meta field as group title
- Gallery shortcode numerical sorting
- Is there a reason why Pages are not publicly_queryable?
- Check return value of get_posts
- How Can I Change The Tax Query For The Main Loop For Taxonomy Archives?
- Exclude some authors from query
- The most effective way to split by post type in custom query?
- Get a list of posts by specific category
- WordPress Query String: get_posts(‘cat=5’) vs WP_Query( ‘cat=5’) vs URL: /site/?cat=5
- apply custom where to the default $wp_query
- WP_Query – Adding “offset” posts to the end of the loop
- wp_query serialised array
- Multiple wordpress queries with nested output (odd – even)
- Using Transients
- it’s possible make a WP_Query with math operations?
- show posts with range meta key
- how to write wordpress query for multiple metakeys checking?
- Sorting search results with custom dropdown
- wp_query get attachments in larger size
- Force WordPress to be more random
- Show posts of an advanced search form
- Query using string from custom field as array value
- Category based on post id
- posts_per_page is not working
- Widget only in first post
- Query WP Page for Buddypress Group Home [closed]
- WP Query orderby ACF boolean values and ACF field value
- How to separate two columns from one content on a page template?
- Get Post Title from different post type based on current loops post_parent using
- How can I order a post query’s results based on the number of matching taxonomy terms?
- wp query to use both author id and meta_query
- How to make the WP query search for the “s” arg in other places too
- WP_Query for a taxonomy value OR a custom post type meta field
- WP_query pagination on frontpage
- WordPress Query by Category using Post Slug
- Select multiple categories with is_tax
- Display Search Results by tag_ID in my search.php
- Repeat array inside array through while loop
- What’s causing an infinite loop?
- pages shortcode filtering by category
- How to set up pagination for a custom loop on a global template (author.php, tag.php, archive.php?)
- Ignoring ‘a’ when sorting posts
- Issue generating custom filter for cpt admin columns
- Duplicate a Query Built with PHP and Mysql but now in WordPress
- UPDATED: Save a custom_field value when automatically creating a post using wp_insert_post
- How to take parameters from a function and make them editable as attributes in a shortcode
- What method does this eventually call: do_action_ref_array( ‘parse_query’, array( &$this ) );
- WP_Query secondary query failing
- Custom search (wp query by custom fields)
- pre_get_posts or $where, which one to use?
- Sorting is not working in WordPress WP_Query
- Add custom WP_Query after the first 3 posts
- Limit the number of posts from a specific category on index.php
- Some images not being returned with wp_get_attachment_image
- Weird results using wp-query with ‘date_query’ for last week
- Query for page content, and query for posts on the same page?
- Limit the number of posts via wpquery
- WP query with multiple custom meta not respecting orderby
- 1500+ duplicate queries via get_option function (query monitor)
- WordPress Ajax search filter on dropdown select
- Adding a language rule and displaying posts with a custom taxonomy term on its archive page
- Use custom url params with value from a custom field to return the post containing the field value
- WP_Query on custom taxonomy -> Location and Activity