Custom Redirects Hide Backend causes ajax 302 error
-
Hi,
Have just run into an issue where when setting custom redirects, specifically setting the ‘Hide backend’ option. When ‘Hide backend for xxx’ is set, when a user with that role attempts to perform an ajax call (admin-ajax.php) then a response of 302 moved temporarily occurs.
Whilst investigating this issue I have identified a fix that works for my site (https://cloughit.com.au) and may be beneficial to be added to a future release.
/wp-content/plugins/custom-login-page/custom-login-page.php
Change line 381:
if (isset($user->roles) && in_array($user->roles[0], self::$options['hide_backend'])) :
to:
if ( ( isset( $user->roles ) && in_array( $user->roles[0], self::$options['hide_backend'] ) ) && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) :
Hope this helps.
- The topic ‘Custom Redirects Hide Backend causes ajax 302 error’ is closed to new replies.