url rewriting – Rewrite custom post type URL in search


I have a website in which I have a custom post type (guest authors from CoAuthors Plus). With a plugin I managed to make post of custom type “guest author” searchable by WordPress legacy search.

Now, the authors are correctly shown in search results. Although, they are linked to a wrong page, /?post_type=guest-author&p=2148, which brings to a 404.

I’d like to be able to get the URL, interprete it, and redirect to the correct page (which is in the form of /archives/author/name-surname/.

I’m trying to get it working with a rewrite URL, but I’m not able to catch the data and formulate the rewrite.

Emilio Dalla Torre 6 months 2021-05-26T13:00:00-05:00 0 Answers 0 views 0

Leave an answer