insert link to page uses old path (of renamed\moved page).
Permalink
A client has just complained that the "Insert link to page" is no longer working. This is true. The reason it's not working is that it is inserting the wrong path. It's using the path to an older version of the page before it was renamed\moved.
I have checked the canonical url in the page properties and it is correct.
[I have cleared the cache via the dashboard too].
Why is this happening? When a page is moved or renamed isn't the path supposed to be automatically changed?
Any ideas how I can fix this?
A lot of pages have been moved so this is a serious issue.
I have checked the canonical url in the page properties and it is correct.
[I have cleared the cache via the dashboard too].
Why is this happening? When a page is moved or renamed isn't the path supposed to be automatically changed?
Any ideas how I can fix this?
A lot of pages have been moved so this is a serious issue.
I think this is a bug.
Inside the getCollectionPathFromID function in page.php is the following query:
"select cPath from PagePaths inner join CollectionVersions on (PagePaths.cID = CollectionVersions.cID and CollectionVersions.cvIsApproved = 1) where PagePaths.cID = ?"
It is called via $db->getOne() so the intention is only to get one result. In the case of the page on my client's site there are 4 cpaths in the table, all four of them get returned and presumably the getOne simply grabs the first one, which is an incorrect older path.
The issue could be resolved by checking the canonical field.
I may be wrong but it looks like once you have multiple cpaths in the pagePaths table then there will be issues with "insert link from page" and possibly other areas.
Can a C5 staffer, or c5 expert check this out?
Inside the getCollectionPathFromID function in page.php is the following query:
"select cPath from PagePaths inner join CollectionVersions on (PagePaths.cID = CollectionVersions.cID and CollectionVersions.cvIsApproved = 1) where PagePaths.cID = ?"
It is called via $db->getOne() so the intention is only to get one result. In the case of the page on my client's site there are 4 cpaths in the table, all four of them get returned and presumably the getOne simply grabs the first one, which is an incorrect older path.
The issue could be resolved by checking the canonical field.
I may be wrong but it looks like once you have multiple cpaths in the pagePaths table then there will be issues with "insert link from page" and possibly other areas.
Can a C5 staffer, or c5 expert check this out?
It still has the old urls stored for this page id but it correctly has the new one marked as the canonical.
So it seems that somehow the code that adds the link has picked up the wrong one (?)