Make WordPress Core

Opened 8 years ago

Closed 5 years ago

Last modified 5 years ago

#38134 closed enhancement (worksforme)

Allow wp_no_robots to be hooked

Reported by: tomdxw's profile tomdxw Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6.1
Component: General Keywords:
Focuses: Cc:

Description

It was decided in #22876 that

<meta name='robots' content='noindex,nofollow' />

would be replaced with

<meta name='robots' content='noindex,follow' />

But for those who would prefer noindex,nofollow there's no way to change it without a lot of hassle.

A change as simple as this would make it very flexible:

function wp_no_robots() {
        echo apply_filters('wp_no_robots', "<meta name='robots' content='noindex,follow' />\n");
}

Change History (3)

This ticket was mentioned in Slack in #core by noisysocks. View the logs.


5 years ago

#2 follow-up: @peterwilsoncc
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

This was discussed in a triage session today, it may have changed since this ticket was opened but it is now possible to unhook the wp_no_robots function.

The following code will remove it and similar code to that above can be used to hook on to wp_head.

<?php
remove_action( 'wp_head', 'wp_no_robots' );

It's also worth noting that for private blogs, for example those with search engine indexing disabled, the default meta tag content was changed to nofollow

Last edited 5 years ago by SergeyBiryukov (previous) (diff)

#3 in reply to: ↑ 2 @SergeyBiryukov
5 years ago

Replying to peterwilsoncc:

it may have changed since this ticket was opened but it is now possible to unhook the wp_no_robots function.

Just to clarify, that has always been the case since its introduction in [19304].

Last edited 5 years ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.