Make WordPress Core

Opened 4 weeks ago

Last modified 3 weeks ago

#63467 new defect (bug)

function do_robots() should use admin_url()

Reported by: hrohh's profile Hrohh Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.8
Component: Privacy Keywords: has-patch
Focuses: administration, privacy Cc:

Description

Dear all,

we have /wp-admin/ hardcoded in do_robots() function. How can i use filter admin_url('admin-ajax.php') ?

<?php
        $site_url = parse_url( site_url() );
        $path     = ( ! empty( $site_url['path'] ) ) ? $site_url['path'] : '';
        $output  .= "Disallow: $path/wp-admin/\n";
        $output  .= "Allow: $path/wp-admin/admin-ajax.php\n";

Thank you.

Change History (2)

#1 @Hrohh
4 weeks ago

  • Summary changed from function do_robots() should use admin_url() a to function do_robots() should use admin_url()

This ticket was mentioned in PR #8834 on WordPress/wordpress-develop by @yogeshbhutkar.


3 weeks ago
#2

  • Keywords has-patch added

Trac ticket: https://core.trac.wordpress.org/ticket/63467

### Description

This PR introduces the use of the admin_url() function to dynamically retrieve the admin URL, replacing previously hardcoded values.

### Screenshots

InstallationBeforeAfter
Single Sitehttps://github.com/user-attachments/assets/ba7120a7-b553-4d10-a3db-92c8e5d9db42https://github.com/user-attachments/assets/7213c20b-b523-40d5-ae87-abed445fae6c
Multisitehttps://github.com/user-attachments/assets/1ff15b2b-20f9-42d3-bcbd-6c0a6ee7b34fhttps://github.com/user-attachments/assets/239f5a9b-9e33-4188-9957-a4ec34d342bc
Note: See TracTickets for help on using tickets.