Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Need a fix for Access-Control-Allow-Origin error WordPress


Hi, I created a twitter news ticker which was working just fine and all of a sudden stopped.
I have it running here:
and it stopped running here:
I need it to work on the second site.
The error seems to be something called Access-Control-Allow-Origin which is preventing it from working and currently messing up the site. Does anyone have a quick fix? I really need a fast solution.

Answers (3)


Pixel Coder answers:

Looks like it's working here....

Attached image...

Unless I missed something?

lifeblogs comments:

I attached a print screen on my question of what it looked like. It's working now for some reason (i don't understand why), but if that error message happens again, I still need to know what to do or how to prevent it from happening. When it occurred, it also messed up the main slider. I googled the error and what people have been writing about it is over my head. Any ideas on how to prevent this happening again?

Pixel Coder comments:

I believe it's a XSS issue also known as cross site scripting. Without knowing the full extent of this as it's more in the realms of security and not design you'd be asking the wrong person.

However when you're using the Twitter stream script, make sure the code follows the conventions set-out by the Twitter api and they wont give you into trouble for XSS.

Pixel Coder comments:

Also, you should probably add some logic for when no messages are returned (Twitter may go down for example) looks like your code just exits when nothing is returned.

The script should really have a fail safe for that.

lifeblogs comments:

Can you check that, or tell me how? And how to put in something to show up if twitter goes down?

Pixel Coder comments:

Could you post the code where the Twitter stream is being called?

Also if you happen to know any other code associated with it please post.

lifeblogs comments:

I followed this tutorial to get it to work

Pixel Coder comments:

That plugin is old and hasn't been updated.

It uses a popular script known as Magpie to read in the RSS feed of the Twitter user and then put it on the page.

Just so happens that Twitter changed the URL recently and I believe that this is effecting your code.

It does work intermittently but you should not count on this.

If you open up within the WordPress plugin....


You will notice at line 54 this line

$messages = fetch_rss(''.$username.'.rss');

This URL no longer exists as you can see below.

Also for the BBC

That has since been replaced with a user ID

You can find your id using a site like this.

However again, this method can be flakey.

Also, with a piece of code that <strong>relies</strong> on Twitter being online to show messages 100% of the time will break.

If you're adament on that not happening, you need to store the Tweets in a database and bring them out accordingly.

I recommend using one of Twitters own widgets and change your design accordingly.

You could then swap out your recent posts to the header region of the site.

It's not ideal as understandably a whole lot happens on WordPress but if you want something 100% reliable, you gotta pay for it.

Pixel Coder comments:

It's not ideal as understandably a whole lot happens on WordPress but if you want something 100% reliable, you gotta pay for it.

Sorry I did mean to say Twitter and not WordPress =p

lifeblogs comments:

Hi, I'm not following what to do. This is not in my area of coding so I need specific instructions. Also, it just went down again.. but not on the test site.

Pixel Coder comments:

Have someone develop you a robust Twitter script or use a widget (as seen on and re-design the header area of your web site to not have this Twitter plugin.

Beyond that, I have nothing else. Sorry :p


Peter Michael answers:

Works fine for me on both sites


Kannan C answers:

When i read that plugin code when you previously posted a problem on this, it is an error message will be shown when no messages will be available to download from the twitter rss. May be it is due to server down