Step 1:
Create a page with slug ‘profile’ in your WordPress Dashboard.
Step 2
Use this function to register profileId
var.
add_filter('query_vars', 'wp233_query_vars');
function wp233_query_vars( $query_vars ){
$query_vars[] = 'profileId';
return $query_vars;
}
And add a rewrite rule to wordpress like this:
add_action( 'init', 'wp233_add_rewrite_rules' );
function wp233_add_rewrite_rules() {
add_rewrite_rule(
'^profile/([^/]+)?$',
'index.php?pagename=profile&profileId=$matches[1]',
'top');
}
Step 3
Now you can access the query var like this:
http://yoursite.com/profile/xxxx/
Now you should be able to extract the profileId by hooking in suitable action
Example
add_action( 'template_redirect', 'wp233_get_profile_id' );
function wp233_get_profile_id() {
$profile_id = get_query_var( 'profileId' );
if ( $profile_id ) {
// do some magic work. you now captured the profile id
// which was passed to url.com/profile/{ID}/ -> here.
}
}