Skip to content

Instantly share code, notes, and snippets.

.intro { background:#eee; }
.intro h1 { color:#000; }
.intro p { color:#333; }
function remove_yoast_json($data){
$data = array();
return $data;
}
add_filter('wpseo_json_ld_output', 'remove_yoast_json', 10, 1);
"breadcrumb": {
"@type": "BreadcrumbList",
"itemListElement":
[
{
"@type": "ListItem",
"position": 1,
"item":
{
"@id": "https://www.coywolf.news",
@henshaw
henshaw / accessible-number-input.html
Created April 7, 2021 16:40
Accessible number input
<input type="text" pattern="[0-9]*" inputmode="numeric">
@henshaw
henshaw / block-floc-wordpress.php
Last active September 29, 2021 03:51
Block FLoC in WordPress
// Disable FLoC
function disable_floc($headers) {
$headers['Permissions-Policy'] = 'interest-cohort=()';
return $headers;
}
add_filter('wp_headers', 'disable_floc');
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"item": {
"@id": "https://coywolf.pro",
"name": "Coywolf"
@henshaw
henshaw / gravatar-alt-author-wordpress.php
Created July 18, 2021 15:54
Add ALT attribute with author name to Gravatar image in WordPress – Copy to functions.php
// Adds ALT attribute with author name to Gravatar image in WordPress
function replace_content($text)
{
$alt = get_the_author_meta( 'display_name' );
$text = str_replace('alt=\'\'', 'alt=\''.$alt.'\'',$text);
return $text;
}
add_filter('get_avatar','replace_content');
@henshaw
henshaw / gist:5cf736e248e0f0edd6a1e195b9bd6852
Created July 21, 2021 00:42
WordPress WebP quality setting - Save in functions.php
// Use a quality setting of 75 for WebP images.
function filter_webp_quality( $quality, $mime_type ) {
if ( 'image/webp' === $mime_type ) {
return 75;
}
return $quality;
}
add_filter( 'wp_editor_set_quality', 'filter_webp_quality', 10, 2 );
@henshaw
henshaw / external-link-style-image.css
Last active August 7, 2021 03:40
External link style that displays image/icon after the text