WordPress.org

Make WordPress Core

Opened 6 months ago

Closed 6 months ago

Last modified 4 months ago

#52862 closed enhancement (invalid)

Rearrange Test-order in function: wp_is_local_html_output

Reported by: espiat Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.7
Component: Site Health Keywords:
Focuses: Cc:

Description

Hi.

Since 5.7 i saw many sites with an SSL Error in the Site Health overview.

Reason: The function wp_is_local_html_output is checking the response header for rds, wlmmanifest and rest.

Many, many seo, optimize, and maintenace plugins remove the rds and qlmanifest meta tags.

The chance that there is some rest link in the header is far greater - i think.

My suggestion is to change the order of the checks.

New order:

  1. has_action( 'wp_head', 'rest_output_link_wp_head' )
  2. has_action( 'wp_head', 'wlwmanifest_link' )
  3. has_action( 'wp_head', 'rsd_link' )

This increases the likelihood that the check will run and confuse the user less.

Source: https://github.com/WordPress/WordPress/blob/e1239d91a95177506d1e3cc0a6ed8ed3232130f6/wp-includes/https-detection.php?fbclid=IwAR2hvdv1bkgypk0tZW__n2Wirr5scyOlhKyARSV3a__JR5bHrnlIPshM7HU#L204


I have one more code note.

The code is a bit difficult to read from my point of view.

You have to go to the end of the line to understand what is going on.

My suggestion would be from the following code:

<?php
return false! == strpos ($html, $pattern);

to do this:

<?php
return strpos ($html, $pattern) === false ? false : true;

But it can also be that this does not correspond to your code standard.

Change History (3)

#1 @espiat
6 months ago

  • Resolution set to invalid
  • Status changed from new to closed

#2 @espiat
6 months ago

I checked it out again.
Change the order, would have no effect.

But, is there no other way to check if HTML was generated by this site?

I closed the ticket. Sorry.

#3 @desrosj
4 months ago

  • Keywords reporter-feedback dev-feedback 2nd-opinion removed
  • Milestone Awaiting Review deleted

Hi @espiat,

Welcome to Trac! I'm sorry that this did not receive a response in a more timely manner.

If you are still looking for an answer to your question, I recommend heading over to the WordPress.org Support Forums. Trac is not for general support.

Note: See TracTickets for help on using tickets.