The Problem
In Orange County, we organize a golf tournament for the day before WordCamp WordCamps are casual, locally-organized conferences covering everything related to WordPress. They're one of the places where the WordPress community comes together to teach one another what they’ve learned throughout the year and share the joy. Learn more.. The page I’d want to hide from WordPress search is a confirmation page with details about the event for the subset of attendees who are going to that event. It’s nothing secret, just didn’t want it to be confusing for other attendees if they were searching for “golf” looking for the announcement post about the golf tournament and found the confirmation page I created.
In discussions on #meta-wordcamp another related use case was brought up by @kcristiano:
Another use case I’ve had is posting Speaker, Volunteer info, and sponsor information to the site. Much easier for those folks to find nothing “secret” beyond perhaps the date/time of volunteer event. We don’t put the page in the menu, the url is given to those who need it. Would be nice to not have search engines index and wp search not find it. Keeps all the info in the site (as opposed to Gdocs).
The Proposal
- Create a checkbox in the publish metabox with a label “Don’t show this page in search results” (or similar messaging)
- Create a filter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. on search results query to exclude pages with the meta Meta is a term that refers to the inside workings of a group. For us, this is the team that works on internal WordPress sites like WordCamp Central and Make WordPress. key we store for the checkbox.
- Create a filter on all related json JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML. api endpoints to exclude pages with the meta key we store for the checkbox.
- Add
noindex
tags to pages that have the checkbox selected
Please weigh in with your thoughts on the usefulness/need for this feature.
#wordcamps #feature-request