[wp-trac] [WordPress Trac] #52713: Reverse logic in wp_robots function and filter
WordPress Trac
noreply at wordpress.org
Thu Mar 4 18:17:11 UTC 2021
#52713: Reverse logic in wp_robots function and filter
--------------------------+-----------------------------
Reporter: Cybr | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
From https://developers.google.com/search/docs/advanced/crawling/special-
tags:
> In the case of conflicting robots (or googlebot) meta tags, **the more
restrictive tag applies**. For example, if a page has both `max-
snippet:50` and `nosnippet` tags, the `nosnippet` tag will apply.
In WP 5.7 RC2, in `wp_robots()`, the following code does the complete
opposite, where now the **less restrictive tag applies**:
{{{
// Don't allow mutually exclusive directives.
if ( ! empty( $robots['follow'] ) ) {
unset( $robots['nofollow'] );
}
if ( ! empty( $robots['nofollow'] ) ) {
unset( $robots['follow'] );
}
}}}
I consider this harmful, and I urge swapping the statements. One plugin
might not want a page have its links followed, whereas another could allow
it at a lower priority still.
I find it curious the `archive` and `follow` tags are considered for the
overriding, but `index` is not...?
Moreover, the same Google Developers-page states:
> The default values are `index, follow` and **don't need to be
specified**.
But now, since `wp_robots()` permits and encourages those non-directives,
the header will become filled with redundant information. I suggest not
acknowledging `index/follow/archive/all` el al. at all.
Perhaps it would be best to remove the "Don't allow mutually exclusive
directives"-block entirely.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52713>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list