By default, wp_resource_hints() prints hints for s.w.org
, I am trying to change the default printed value. I am not trying to get rid of the hook, I indeed need it and want to use it, however witout s.w.org
.
function resource_hints( $hints, $relation_type ) {
if ( 'dns-prefetch' === $relation_type ) {
$key = array_search( '//s.w.org', $hints, true );
if ( false !== $key ) {
unset( $hints[ $key ] );
}
$hints[] = 'http://make.wordpress.org';
} elseif ( 'prerender' === $relation_type ) {
$hints[] = 'https://make.wordpress.org/great-again';
}
return $hints;
}
add_filter( 'wp_resource_hints', 'resource_hints', 999, 2 );
The function works for adding values for dns-prefetch
, preconnect
, prefetch
, and prerender
, however I cannot get rid or edit the first s.w.org
resource hint. How can I do this please?