Fixing ajax calls
authorLaury GvR <laury@gaslightmedia.com>
Wed, 4 Mar 2015 14:44:31 +0000 (09:44 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Wed, 4 Mar 2015 14:44:31 +0000 (09:44 -0500)
functions.php

index e20ccb7..be8941e 100755 (executable)
@@ -130,13 +130,13 @@ add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 48;' ), 20 )
 
 function redirect_user_on_role()
 {
-    if(isset($_REQUEST['action'])):
+    if(!isset($_REQUEST['action']) && !current_user_can('publish_pages')):
         do_action( 'wp_ajax_' . $_REQUEST['action'] );
         do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] );
+        wp_redirect( home_url() ); exit;
     endif;
     if (!current_user_can('publish_pages') ) {
         /* A non-admin, non-editor */
-        wp_redirect( home_url() ); exit;
     }
     //If login user role is Subscriber
     // if ($current_user->user_level !== 0)