Search code examples
wordpresshref

Wordpress automatically adding site url to href, though href not empty


So I'm trying to debug a somewhat confusing problem. I'm using a Wordpress plugin for a Topspin store that uses colorbox to popup a window to display more information about an item. Here's the site: okgo.net/store. In the backend code for this page a div block is created containing links that that should look like this:

<a class="topspin-view-item" href="#!/77022">

The php that does that is as follows:

<a class="topspin-view-item" href="#!/<?php echo $item['id']; ?>">

The problem is that what is being spat out at the end is not that. It looks like this:

<a class="topspin-view-item" href="http://okgo.net/video-store/#!/89712">

I've understood from another post on here that the default behavior of Wordpress is to fill empty hrefs (ie href="") with the site url. So my guess is that Wordpress is for some reason interpreting this as an empty href? Except that that doesn't seem quite right either.

I've played around with this a bit. One thing that happens is that if I remove the has from the above PHP the siteurl is not output at all. That of course breaks my code.

Any ideas? Any help would be warmly appreciated.


Solution

  • The way we ended up fixing this for those who may be interested is by simply adding the following line of code to the jQuery handler that dealt with the on submit event:

    event.preventDefault()
    

    Perhaps this will be of help to someone...