Question

I'm having a very strange issue with the permalinks for a custom post type.

I'm displaying a list of all the posts within the "accommodations" custom post type that I've created on a custom page template. The URL for this page is /accommodations/

Part of this list includes the permalink for each post that links to /accommodation/gold-bottom-cabins/ for example. This links to the single post that uses a template called single-attraction.php

When I hover over the link I can see that it is linking to the correct URL (/accommodation/gold-bottom-cabins/) however when I click the link it goes to /accommodations/undefined

The strange thing is is that if I right-click and open the link in a new tab, it links to the proper URL and works fine.

Any ideas?

I've tried re-creating the .htaccess file by re-saving my permalinks with no luck.

Was it helpful?

Solution

I suspect you have some sort of JavaScript / jQuery plugin attempting to bind to the click event of your link for a couple of reasons...

1) Single click (left click) behaves differently than right click -> new tab. (And I suspect if you copy/paste the URL into a new tab it'll work fine).

2) The word undefined shows up in JavaScript when you attempt to use a variable or call a function that is undefined.

I would inspect the console and see what errors might be reported.

If you don't have any errors in the console I would inspect the links themselves and look for any classes or wrappers that would indicate a plugin might be trying to target them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top