[wp-trac] [WordPress Trac] #52862: Rearrange Test-order in function: wp_is_local_html_output

WordPress Trac noreply at wordpress.org
Fri Mar 19 07:38:11 UTC 2021

#52862: Rearrange Test-order in function: wp_is_local_html_output
 Reporter:  espiat       |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Site Health  |    Version:  5.7
 Severity:  normal       |   Keywords:  reporter-feedback dev-feedback 2nd-
  Focuses:               |  opinion

 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

 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



 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:

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

 to do this:

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

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

Ticket URL: <https://core.trac.wordpress.org/ticket/52862>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list