First, adding a rewrite tag and a query var is redundant, adding the tag adds the query var.
Second, $matches corresponds to each regex pattern you have in your rule, so it should be $matches[1] and $matches[2], not 2 and 4.
Last, for a single member, you can just set the member query var.
add_rewrite_rule(
'^member/([^/]*)/book/([^/]*)/?',
'index.php?member=$matches[1]&book_name=$matches[2]',
'top'
);
Untested, but should get you going in the right direction. Also check out this rewrite analyzer plugin to help you construct your rewrite rule.
Related Posts:
- Prettified page URL w/ query var redirects to prettified page URL w/o query var
- why is are these rewrite_tags and rules not working?
- Redirect taxonomy to custom template to list terms in taxonomy
- Multiple values in a rewrite rule, is it possible?
- What add_rewrite_tag()’s RegEx matches against?
- Rewrite rules and query for virtual page
- add_rewrite_rule query_var not being set
- add_rewrite_endpoint not working
- add_rewrite_rule permalinks break in WordPress 4.5
- Rewrite Rule for Post Meta
- Why isn’t my rewrite rule working when there is no second parameter?
- WordPress add a rewrite rule to a page to accept a GET variable
- Custom Fields Query Vars and Rewrite not working
- Last query_var not working with rewritten URL
- How to use endpoint, but remove/rewrite endpoint base?
- `query_var` values empty in theme file after `add_rewrite_rule` redirection
- When should add_rewrite_tag() be used?
- Why does everybody hook add_rewrite_rule on init
- add_rewrite_rule() vs $wp_rewrite->rules vs ‘rewrite_rules_array’?
- How to check if a rewrite rule exists
- add_rewrite_rule not producing anything in $_GET
- Flush_rewrite_rules not working when settings updated
- Case-insensitive add_rewrite_rules in WordPress functions
- Custom Rewrite with Query vars
- Rewrite Rule for Custom Page with Query Vars in URL
- flush_rewrite_rules() cancels the effect of add_rewrite_rule()
- Separate posts by chapter per rewrite
- How to change the matches in add_rewrite_rule
- Using add_rewrite_rule() to redirect to Front Page
- add_rewrite_rule() not working
- WordPress rewrite rules for state and city
- add_rewrite_rule parameter is not received by the page
- add_rewrite_rules prefix everything
- How to Modify Existing Rewrite Rules?
- Can someone explain the function of the third parameter of “add_rewrite_tag”
- How to restore WP 5.4 behaviour where a numeric string could added to each page URL and parsed as “page” in WP 5.5?
- get_query_var with add_rewrite_rule and add_filter(‘query_vars’) not working
- Can rewrites fallback if 404? Rewrite conflict issue
- Reading Settings -> Front Page displays “Static Page” being reset
- why does add_rewrite_rule refresh and loose url variables
- Where do I USE add_rewrite_rule?
- add_rewrite_rule confusion
- Uppercase to Lowercase in URL
- How to use rewrite rule or rewrite endpoint to switch languages?
- How to add custom variable in url without redirect?
- Rewrite rule to prettify two $_GET variables while in a new endpoint from a page
- Remove rewrite endpoint on deactivation?
- Do I need to flush rewrite rules when creating new user if using custom author rewrite rules?
- Hooking “delete_option_rewrite_rules” for rewrite rule addition
- WordPress shows front page, when it should show 404 with pagination style urls
- Rewrite URLs – Custom Post Type – Post Slug, Taxonamy Slug
- Rewrite rule problem
- add_rewrite_rule redirects if value = 1
- Redirect Uploads Folder to Query Vars in WordPress
- Custom permalink leads to index page
- How to add rewrite rule for external php file
- Help with rewrite rules for two post types
- How to test custom rewrite rules /permalinks?
- Rewrite Rules problem when rule includes homepage slug
- add_rewrite_rule() not stored (I think)
- flush_rewrite_rules() not working on updating Settings API
- Redirect old query string URLs to new add_rewrite_rule URL
- Rewrite rules for short URL
- How do I turn off the blog and archives?
- Adding a custom rewrite rule for gallery/categories page
- How to do make mysite.com/post-name/sub-post?
- Custom rewrite rules for a page with GET variables?
- How can I resolve search error with pagination wordpress
- wordpress path generation from rewrite rule
- add_rewrite_rule() issue with parent/child/child page
- Multiple Taxonomy Items for Separate URLs
- WordPress – replicate same globals, query vars and query for an alternate endpoint
- WordPress add_rewrite_rule with 2 variables
- Custom permalink question
- Rewrite rule not working, issue may be in URI request
- Rewrite post type into a page with year filter
- How to create a custom URL to another domain in WordPress
- Rewrite Rules, Query Vars and Pagination
- Pretty links with add_rewrite_rule and add_query_var
- Create new URL structure for custom post types
- Flush rewrite rules when every page gives 500 error?
- How to change URL in WordPress
- WordPress Rewrite rule with custom query var
- default ‘post’ post type: not forcing url rewrite when args set
- How to add rewrite rule to point to file
- Adding custom slugs: parent-page/username/child-page/
- WordPress Custom post type single page 404 error
- Rewrite URL to plugin file
- Rewrite for page with a possible unknown parent page
- Rewrite the WordPress URL from custom plugin
- add_rewrite_rule works only with one “directory”
- URL Rewrite for CPT single posts
- How to Add Rewrite Ruled Argument Into Permalink Properly
- add_rewrite_rule() driving me crazy, rewrite not working when analyzer says it should
- Redirect to a file in a WordPress theme directory
- What is the `rewrite_rules` option the options table in the WordPress database?
- make a new structure tag that does some processing
- add_rewrite_rule doesn’t work when trying to add a new parameter at the end of URL
- rewriteRules WP6
- How does WordPress manage to differentiate between post and page URLs without a distinct base, and how can I replicate this functionality?