• Resolved mapdi

    (@mapdi)


    Hi there,

    Once again Thank you very much for the best WP Search Plugin out there!

    We have an issue, perhaps someone could find a solution!

    We disabled the WP Admin Dashboard for subscribers with:

    add_action('admin_init', 'disable_dashboard'); 
    function disable_dashboard() { 
    	if (current_user_can('subscriber') && is_admin()) { 
    		wp_redirect(home_url()); exit; } }

    If subscriber logged in Ajax search isn’t working. It’s showing the whole website …

    Is it possible to disable Ajax search only for logged in subscribers?

    Or any other idea how to solve this?

    Best regards!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Vinod Dalvi

    (@vinod-dalvi)

    I hope you are well today and thank you for your question.

    I am troubleshooting it and will update you here shortly.

    Best regards,

    Plugin Author Vinod Dalvi

    (@vinod-dalvi)

    Please try changing the above shared code as following.

    add_action('admin_init', 'disable_dashboard'); 
    function disable_dashboard() { 
    	if (current_user_can('subscriber') && is_admin() && ! wp_doing_ajax() ) { 
    		wp_redirect(home_url()); exit; } }
    Thread Starter mapdi

    (@mapdi)

    @vinod-dalvi

    This worked fine.
    Didn’t know there is function wp_doing_ajax()

    Thank you!

    Plugin Author Vinod Dalvi

    (@vinod-dalvi)

    You are always welcome here ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Disable Ajax Search only for logged in Subscribers’ is closed to new replies.