WP site after login keeps redirecting to looped url

My site Example.com keeps on redirecting to following url https://example.com/?redirect_to=https%3A%2F%2Fexample.com%2F%3Fredirect_to%3Dhttps%253A%252F%252Fexample.com%252F%253Fredirect_to%253Dhttps%25253A%25252F%25252Fexample.com%25252F%25253Fredirect_to%25253Dhttps%2525253A%2525252F%2525252Fexample.com%2525252F%2525253Fredirect_to%2525253Dhttps%252525253A%252525252F%252525252Fexample.com%252525252F%252525253Fredirect_to%252525253Dhttps%25252525253A%25252525252F%25252525252Fexample.com%25252525252F%25252525253Fredirect_to%25252525253Dhttps%2525252525253A%2525252525252F%2525252525252Fexample.com%2525252525252F%2525252525253Fredirect_to%2525252525253Dhttps%252525252525253A%252525252525252F%252525252525252Fexample.com%252525252525252F%252525252525253Fredirect_to%252525252525253Dhttps%25252525252525253A%25252525252525252F%25252525252525252Fexample.com%25252525252525252F%25252525252525253Fredirect_to%25252525252525253Dhttps%2525252525252525253A%2525252525252525252F%2525252525252525252Fexample.com%2525252525252525252F%2525252525252525253Fredirect_to%2525252525252525253Dhttps%252525252525252525253A%252525252525252525252F%252525252525252525252Fexample.com%252525252525252525252F%252525252525252525253Fredirect_to%252525252525252525253Dhttps%25252525252525252525253A%25252525252525252525252F%25252525252525252525252Fexample.com%25252525252525252525252F%25252525252525252525253Fredirect_to%25252525252525252525253Dhttps%2525252525252525252525253A%2525252525252525252525252F%2525252525252525252525252Fexample.com%2525252525252525252525252F%2525252525252525252525253Fredirect_to%2525252525252525252525253Dhttps%252525252525252525252525253A%252525252525252525252525252F%252525252525252525252525252Fexample.com%252525252525252525252525252F%252525252525252525252525253Fredirect_to%252525252525252525252525253Dhttps%25252525252525252525252525253A%25252525252525252525252525252F%25252525252525252525252525252Fexample.com%25252525252525252525252525252F%25252525252525252525252525253Fredirect_to%25252525252525252525252525253Dhttps%2525252525252525252525252525253A%2525252525252525252525252525252F%2525252525252525252525252525252Fexample.com%2525252525252525252525252525252F%2525252525252525252525252525253Fredirect_to%2525252525252525252525252525253Dhttps%252525252525252525252525252525253A%252525252525252525252525252525252F%252525252525252525252525252525252Fexample.com%252525252525252525252525252525252F%252525252525252525252525252525253Fredirect_to%252525252525252525252525252525253Dhttps%25252525252525252525252525252525253A%25252525252525252525252525252525252F%25252525252525252525252525252525252Fexample.com%25252525252525252525252525252525252F%25252525252525252525252525252525253Fredirect_to%25252525252525252525252525252525253Dhttps%2525252525252525252525252525252525253A%2525252525252525252525252525252525252F%2525252525252525252525252525252525252Fexample.com%2525252525252525252525252525252525252F%2525252525252525252525252525252525253Fredirect_to%2525252525252525252525252525252525253Dhttps%252525252525252525252525252525252525253A%252525252525252525252525252525252525252F%252525252525252525252525252525252525252Fexample.com%252525252525252525252525252525252525252F%252525252525252525252525252525252525253Fredirect_to%252525252525252525252525252525252525253Dhttps%25252525252525252525252525252525252525253A%25252525252525252525252525252525252525252F%25252525252525252525252525252525252525252Fexample.com%25252525252525252525252525252525252525252F%25252525252525252525252525252525252525253Fredirect_to%25252525252525252525252525252525252525253Dhttps%2525252525252525252525252525252525252525253A%2525252525252525252525252525252525252525252F%2525252525252525252525252525252525252525252Fexample.com%2525252525252525252525252525252525252525252F Answers: Thank you for visiting the Q&A section on Magenaut. Please note that all the…

Can anybody provide me with a function to generate slugs?

The functions WordPress uses to generate slugs are scattered in several functions and filters. I cannot find them all. Can anybody provide me a single php function to generate slugs? I do not need all the functionalities of WordPress, just need to encode non-latin characters and remove illegal characters that are not allowed in url.

Woocommerce different URL for every table placed in the restaurant

my company is working with different restaurants to digitize their menus so that people dont touch the menu cards in this Covid 19 pandemic, so every table in a restaurant will have a unique qr placed on it, when a customer scans it the menu will open and he can order it from there, the issue i am facing is how to set all those unique urls linked with the table number, and how to show the table number on the dashboard of woocommerce so that the restaurant knows the table number from which the order came.
thanks and regards
Aetzad