2

I am using owl carosel which takes a hash url to go to a specific slide (http://www.owlcarousel.owlgraphic.com/demos/urlhashnav.html#five)

Lets say I want to visit a password protected page with the slider there (site.com/page#slideone)

When I visit the page I am asked for a password, upon entering it, the hash at the end is removed after the redirect. (redirects to site.com/page on success)

Any idea where I would look to keep the original url intact?

Just to confirm, there are multiple hash urls so I cannot hard code a single one.

Thanks!

0

The issue is that the browser doesn't pass the hash value in the request, it is parsed by the browser itself. Since the server doesn't know about the hash it can't forward it along after the login. You do have access to the hash with javascript though...Without seeing your code I can't give you a specific answer but something like this would probably work:

Assuming you are using wp_login_form(), otherwise change the selectors accordingly

<script>
jQuery(document).ready(function($){
    $redirectField = $('input[name="redirect_to"]');
    $redirectField.val($redirectField.val() + window.location.hash);
});
</script>

You could include that on every page, or better would be to include it using the login_form_bottom filter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.