WordPress.org

Make WordPress Core

Opened 6 years ago

Last modified 4 months ago

#27494 new defect (bug)

Posts page appears into search results

Reported by: SGr33n Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.8.1
Component: Posts, Post Types Keywords: dev-feedback needs-patch 2nd-opinion close
Focuses: Cc:

Description

Hi,

if you set a static home page, so then a page for posts, this page is just a virtual page, because it doesn't have any content, just the title. But, if you search on the site for this title, the virtual page will be shown as search result. In my opinion this should be hidden.

Change History (6)

#1 @MikeHansenMe
6 years ago

I was able to confirm this. I created a page with the title "customtitle" then added some content to the content area(this would not show if set as posts page). Then I did a search for "customtitle" and it showed in the search results with the excerpt from the content area. This could however be desirable for example if the title was "News" and the content said something like check out all our news articles. Unsure if this is expected or a bug.

#2 @DrewAPicture
6 years ago

  • Keywords dev-feedback added

I think this is relatively valid point, that perhaps the page set for page_on_front should be excluded from search results.

#3 @DrewAPicture
6 years ago

  • Component changed from General to Posts, Post Types

#4 @swissspidy
3 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

#5 @Howdy_McGee
4 months ago

  • Keywords 2nd-opinion added

I think at this point flat out hiding the Posts Page and Front Page from search may be unexpected to most users. Adding a get_content filter for some kind of default content may be a better solution. A simple snippet such as:

Posts archive.

#6 @garrett-eclipse
4 months ago

  • Keywords close added

I agree hiding it all together isn't ideal. Although many themes don't support post_content on the posts_page doesn't mean all don't. On many builds I've done we use post_content as an intro to our blog or news section. As well if searching for 'News' or 'Blog' it would make sense to provide a link in the search to those pages as it's what the use was searching for.
*This almost feels more customization territory than core to me as you can update the wp_query through filters to suppress special pages from the results.

Note: See TracTickets for help on using tickets.