Gist 11fa5eff13d1bb06b8c00164ef9c0351
✓ Published0🌍 Public
KKopylovVitalik
Last edited Sep 2, 2020
Created on Sep 2, 2020
This example shows a WordPress filter that controls search engine indexing for author pages, blocking specific authors from being crawled. The code uses the WordPress `add_filter` function with the `wpseo_robots` hook to override the robots meta tag. It checks if the current author ID matches a hardcoded list of 17 user IDs, and if so, returns `'noindex, nofollow'` to prevent search engines from indexing those pages. The filter is written in PHP and relies on the WordPress `is_author()` conditional tag to detect the author archive context, using a numeric array of excluded author IDs as the data source.
AI-generated description