WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 17 months ago

Last modified 17 months ago

#38134 closed enhancement (worksforme)

Allow wp_no_robots to be hooked

Reported by: 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.


17 months ago

#2 follow-up: @peterwilsoncc
17 months 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 17 months ago by SergeyBiryukov (previous) (diff)

#3 in reply to: ↑ 2 @SergeyBiryukov
17 months 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 17 months ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.