Title: Syntax Error &#8211; Unexpected Token
Last modified: August 22, 2016

---

# Syntax Error – Unexpected Token

 *  Resolved [Kuzso](https://wordpress.org/support/users/kuzso/)
 * (@kuzso)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-token/)
 * Hi!
    First, let me tell you, that this plugin is awesome! But I just went in 
   an error, just like the title sais. This error comes up when a not logged in 
   person or a subscriber trying to add something to the cart. When an admin trying
   this, the cart is working perfectly.
 * Things that i made for the site:
    – Made a new category and menu – Disabled the
   admin bar for subscribers – Subscribers can’t reach wp-login page if logged in(
   redirected to main page)
 * If I am logged in as an admin and put something in the cart, then i am go to 
   the order page, everything is fine, but if then i am logging out without finishing
   the order, the order page change itself, which is nice, but before the send button
   it seem like loading infinite times the page header with the navigation.
 * It is a bit annoying error, because i have no idea what can cause this..
 * p.s. Sorry for my english, i just learning it.
 * [https://wordpress.org/plugins/wppizza/](https://wordpress.org/plugins/wppizza/)

Viewing 12 replies - 1 through 12 (of 12 total)

 *  Plugin Author [ollybach](https://wordpress.org/support/users/ollybach/)
 * (@ollybach)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-token/#post-5232365)
 * got a link ?
 *  Thread Starter [Kuzso](https://wordpress.org/support/users/kuzso/)
 * (@kuzso)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-token/#post-5232368)
 * I am sorry, but not right now.
    It is not finished yet, and its on localhost 
   right now.
 *  Plugin Author [ollybach](https://wordpress.org/support/users/ollybach/)
 * (@ollybach)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-token/#post-5232371)
 * sorry, but then i cannot help you as it could be a number of things and i cannot
   begin to even guess
 *  Thread Starter [Kuzso](https://wordpress.org/support/users/kuzso/)
 * (@kuzso)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-token/#post-5232372)
 * Ok, thank you! If i can manage this, i will post here, if i can’t then i will
   post the link if its online.
 *  Plugin Author [ollybach](https://wordpress.org/support/users/ollybach/)
 * (@ollybach)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-token/#post-5232376)
 * ok
 * one thing you ought to check though is the console – on chrome its
    ctr+shift
   +i ->console
 * and see what it says there to start off with
 * chances are – at a guess – there’s a javascript error that stops other javascript
   from executing
 *  Plugin Author [ollybach](https://wordpress.org/support/users/ollybach/)
 * (@ollybach)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-token/#post-5232383)
 * and – as a really wild guess – when you say
 * >Subscribers can’t reach wp-login page if logged in (redirected to main page)
 * you are also redirecting ajax requests
 * (again , just a stab in the dark , but see if disabling whatever you did there
   solves this , in which case you will have to investigate how you are doing this…
   again though, just a wild guess
 * about as much as i can say/suggest without seeing a page/link
 *  Thread Starter [Kuzso](https://wordpress.org/support/users/kuzso/)
 * (@kuzso)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-token/#post-5232385)
 * it is a bit fast, but admin-ajax or something like this pop up and loading the
   main page non-stop into the plugin’s area
 * Maybe the mainpage redirecting causing this?
 *  Thread Starter [Kuzso](https://wordpress.org/support/users/kuzso/)
 * (@kuzso)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-token/#post-5232387)
 * Sorry, didnt see that u wrote before me.
 * This worked!
 * The redirecting checked that the user can or cannot edit posts and if cant then
   redirected to the main page and it was added to the admin_init..
 * Thank you very much!
 *  Plugin Author [ollybach](https://wordpress.org/support/users/ollybach/)
 * (@ollybach)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-token/#post-5232389)
 * sorry, i don’t understand what it is you are saying
 * either way i cannot tell without a link.
 * just – for starters – stop the redirection you are doing and see what happens.
 *  Thread Starter [Kuzso](https://wordpress.org/support/users/kuzso/)
 * (@kuzso)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-token/#post-5232391)
 * I Cleared out the redirection and everything is working well..
 * I think it is used the same way for checking logged in users like the plugin.
 * So this managed the problem, thank you for pointing the right thing!
 *  Plugin Author [ollybach](https://wordpress.org/support/users/ollybach/)
 * (@ollybach)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-token/#post-5232392)
 * ok,
 * you need to refine /edit the way you are doing your redirections then (or just
   use a plugin that does this without interfering with ajax requests)
 *  Plugin Author [ollybach](https://wordpress.org/support/users/ollybach/)
 * (@ollybach)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-token/#post-5232396)
 * glad i could help somewhat though

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Syntax Error – Unexpected Token’ is closed to new replies.

 * ![](https://ps.w.org/wppizza/assets/icon-256x256.png?rev=2498121)
 * [WPPizza - A Restaurant Plugin](https://wordpress.org/plugins/wppizza/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wppizza/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wppizza/)
 * [Active Topics](https://wordpress.org/support/plugin/wppizza/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wppizza/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wppizza/reviews/)

## Tags

 * [Unexpected](https://wordpress.org/support/topic-tag/unexpected/)

 * 12 replies
 * 2 participants
 * Last reply from: [ollybach](https://wordpress.org/support/users/ollybach/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-token/#post-5232396)
 * Status: resolved