0

I have a site where post content gets used as components on several pages. There's also some nested post content which makes it more complicated.

This is a problem in the WordPress search results, when Posts appear independent of the pages they are attached to. I have a redirect that attempts to redirect from the Post to the Page, but when a post appears on multiple Pages, which one is the Parent Page?

Is there a way to rewrite search results? I suppose you could display a Post for each place it appears? Would it make sense to do that?

7
  • It depends on your structure. I would make a search this way: search posts, if you found the needed query - display it, if not - search through pages. I hope it makes sense. Commented Sep 25 at 7:29
  • "when a post appears on multiple Pages, which one is the Parent Page" - which one do you think should be the parent page? Commented Sep 29 at 21:56
  • @ChrisHaas This was badly worded on my part (I updated the title). They are all the parent page. So in the search results I can't simply redirect from the post content to a page parent because there isn't just one. I think I'd need to have to alter the search results to show a different post for each page it appears on, but I don't know how to do that Commented Oct 1 at 15:51
  • The specifics of your situation are still hard for me to process, although I have a general understanding of it. Let's say you have Posts and Pages. On each Post you have excerpts., and on some Pages you are pulling in these Post excerpts. When someone searches for xyz, if that is in a Post excerpt, any Pages that use it might also appear in the results. Although this might not be exactly what you are describing, at a very high level is this a general representation of the situation? Commented Oct 2 at 15:28
  • @ChrisHaas that's right, but in my case those posts should not be accessed directly because they are not independent of the context of the parent page(s). So a post link in the search results should redirect somewhere else, or to multiple places. I'm not sure how to build that context into the search results. Am I describing this all right? I spent a whole day thinking through the problem. Someone could make some money off a plugin to fix this. Commented Oct 3 at 18:04

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.