WordPress add_rewrite_rule redirection match GET variable not passing through to custom template

Remove $query parameter from add_rewrite_tag. Your rewrite tag registration will look like this: add_rewrite_tag('%expert%', '([^&]+)');.

The phrase in the rewrite rule may be '^expert/([^/]+)/?', but it was not the reason for the problem.