Disable New User Notifications

function wpcode_send_new_user_notifications( $user_id, $notify = ‘user’ ) { if ( empty( $notify ) || ‘admin’ === $notify ) { return; } elseif ( ‘both’ === $notify ) { // Send new users the email but not the admin. $notify =…Continue reading

Disable Self Pingbacks

add_action( ‘pre_ping’, function( &$links ) { $home = get_option( ‘home’ ); foreach ( $links as $l => $link ) { if ( 0 === strpos( $link, $home ) ) { unset( $links[ $l ] ); } } } );Continue reading

Remove Query Strings From Static Files

function wpcode_snippet_remove_query_strings_split( $src ) { $output = preg_split( “/(&ver|\?ver)/”, $src ); return $output ? $output[0] : ”; } add_action( ‘init’, function () { if ( ! is_admin() ) { add_filter( ‘script_loader_src’, ‘wpcode_snippet_remove_query_strings_split’, 15 ); add_filter( ‘style_loader_src’, ‘wpcode_snippet_remove_query_strings_split’, 15 ); }…Continue reading

Add default ALT to avatar/Gravatar Images

add_filter( ‘pre_get_avatar_data’, function ( $atts ) { if ( empty( $atts[‘alt’] ) ) { if ( have_comments() ) { $author = get_comment_author(); } else { $author = get_the_author_meta( ‘display_name’ ); } $alt = sprintf( ‘Avatar for %s’, $author ); $atts[‘alt’]…Continue reading

Disable Embeds

/** * Disable all embeds in WordPress. */ add_action( ‘init’, function () { // Remove the REST API endpoint. remove_action( ‘rest_api_init’, ‘wp_oembed_register_route’ ); // Turn off oEmbed auto discovery. add_filter( ’embed_oembed_discover’, ‘__return_false’ ); // Don’t filter oEmbed results. remove_filter( ‘oembed_dataparse’,…Continue reading

Disable Emojis

/** * Disable the emojis in WordPress. */ add_action( ‘init’, function () { remove_action( ‘wp_head’, ‘print_emoji_detection_script’, 7 ); remove_action( ‘admin_print_scripts’, ‘print_emoji_detection_script’ ); remove_action( ‘wp_print_styles’, ‘print_emoji_styles’ ); remove_action( ‘admin_print_styles’, ‘print_emoji_styles’ ); remove_filter( ‘the_content_feed’, ‘wp_staticize_emoji’ ); remove_filter( ‘comment_text_rss’, ‘wp_staticize_emoji’ ); remove_filter( ‘wp_mail’,…Continue reading

Darn slashes

/* Plugin Name: MA Custom Fonts Description: Load custom fonts and inject to Oxygen and Bricks Author: Matthias Altmann Project: Code Snippet: Load custom fonts and inject to Oxygen and Bricks Version: 3.3.1 Plugin URI: https://www.altmann.de/en/blog-en/code-snippet-custom-fonts/ Description: en: https://www.altmann.de/en/blog-en/code-snippet-custom-fonts/ de:…Continue reading