0

I'm trying to get the rewrited URL of my custom post type on the search result page by using:

echo get_permalink(get_the_ID());

This returns the basename of my site plus the post slug, which isn't correct since I've rewritten the URL using the 'rewrite' argument in my register_taxonomy function.

On every page, using get_permalink in the post loop I get the correct URL, except on the search results page. Does anyone have an idea how to solve this?

1 Answer 1

0

Solved, it was an issue with assigned parent- and subcategories.

Because I'm using the 'WP All Import' plugin connected to Google Drive, posts are automatically imported. Since some of the posts don't have categories assign in the Google Drive document, 'WP All import' doesn't assign a category on importing the data.

For some reason this has resulted in duplicate content, importing already existing posts but without a category. Because the latest imported posts are without category and ordered descending by date on the search page, I was under the impression that there was something wrong with the permastructure.

2
  • Could you edit your answer, using the edit link above, and add in what you did to fix your issue to further help users who may run into this issue in the future, please?
    – Howdy_McGee
    Commented Apr 10, 2017 at 14:18
  • Thank you for the suggestion @Howdy_McGee , I've edited my answer accordingly!
    – Tomjesch
    Commented Apr 11, 2017 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.