-
core
WordPress 5.7.1
https://www.wp-plugin-api.com/version/wordpress-5-7-1/ -
script_loader_tag
How to add defer / async in wp_enqueue_script
To add defer / async to enqueued script with id “fontawesome5 <?php wp_enqueue_script(‘fontawesome5’, ‘https://use.fontawesome.com/releases/v5.0.9/js/all.js’, array(), ‘5.0.9’, true); <?php add_filter(‘script_loader_tag’, ‘add_defer’, 10, 2); function add_defer($tag, $handle) { if($handle !== ‘fontawesome5’) { return $tag; } return str_replace(‘ src=’, ‘ defer src=’, $tag); } <?php add_filter(‘script_loader_tag’, ‘add_async’, 10, 2); function add_async($tag, $handle) { if($handle !== ‘fontawesome5’) { return $tag; } return str_replace(‘ src=’, ‘ async src=’, $tag); } Source: https://e-joint.jp/505/ -
core
WordPress 5.7
https://www.wp-plugin-api.com/version/wordpress-5-7/ -
core
WordPress 5.6.2
https://www.wp-plugin-api.com/version/wordpress-5-6-2/ -
core
WordPress 5.6.1
https://www.wp-plugin-api.com/version/wordpress-5-6-1/ https://wordpress.org/news/2021/02/wordpress-5-6-1-maintenance-release/ -
wp_new_user_notification_email
Customize new user notification email
add_filter( ‘wp_new_user_notification_email’, ‘custom_wp_new_user_notification_email’, 10, 3 ); function custom_wp_new_user_notification_email( $wp_new_user_notification_email, $user, $blogname ) { $key = get_password_reset_key( $user ); $message = sprintf(__(‘Welcome to the Community,’)) . “\r\n\r\n”; $message .= ‘To set your password, visit the following address:’ . “\r\n\r\n”; $message .= network_site_url(“wp-login.php?action=rp&key=$key&login=” . rawurlencode($user->user_login), ‘login’) . “\r\n\r\n”; $message .= “After this you can enjoy our website!” . “\r\n\r\n”; $message .= “Kind regards,” . “\r\n”; $message .= “Support Office Team” . “\r\n”; $wp_new_user_notification_email[‘message’] = $message; $wp_new_user_notification_email[‘headers’] = ‘From: MyName<example@domain.ext>’; // this just changes the sender name and email to whatever you want (instead of the default WordPress <wordpress@domain.ext> return $wp_new_user_notification_email; } https://wordpress.stackexchange.com/questions/306642/customize-wp-new-user-notification-email -
woocommerce_is_purchasable
How to Hide ‘Add to Cart’ Button in WooCommerce
add_filter( ‘woocommerce_is_purchasable’, ‘__return_false’); Source: https://wisdmlabs.com/blog/the-right-way-to-hide-add-to-cart-button-in-woocommerce/ -
woocommerce_register_post_type_product
How to change WooCommerce Products post type name
add_filter( ‘woocommerce_register_post_type_product’, ‘so_26712459_post_type’ ); function so_26712459_post_type( $args ){ $labels = array( ‘name’ => __( ‘Tours’, ‘your-custom-plugin’ ), ‘singular_name’ => __( ‘Tour’, ‘your-custom-plugin’ ), ‘menu_name’ => _x( ‘Tours’, ‘Admin menu name’, ‘your-custom-plugin’ ), ‘add_new’ => __( ‘Add Tour’, ‘your-custom-plugin’ ), ‘add_new_item’ => __( ‘Add New Tour’, ‘your-custom-plugin’ ), ‘edit’ => __( ‘Edit’, ‘your-custom-plugin’ ), ‘edit_item’ => __( ‘Edit Tour’, ‘your-custom-plugin’ ), ‘new_item’ => __( ‘New Tour’, ‘your-custom-plugin’ ), ‘view’ => __( ‘View Tour’, ‘your-custom-plugin’ ), ‘view_item’ => __( ‘View Tour’, ‘your-custom-plugin’ ), ‘search_items’ => __( ‘Search Tours’, ‘your-custom-plugin’ ), ‘not_found’ => __( ‘No Tours found’, ‘your-custom-plugin’ ), ‘not_found_in_trash’ => __( ‘No Tours found in trash’, ‘your-custom-plugin’ ), ‘parent’ => __( ‘Parent […] -
gettext
Override translations
Override “Add to Cart” etc for virtual products in WooCommerce <?php add_filter( ‘gettext’, ‘studio_gettext’, 10, 3); function studio_gettext( $translation, $text, $domain ) { if ( ‘woocommerce’ === $domain ) { global $product; if ( ‘%s in stock’ === $text && $product->is_virtual() ){ $translation = ‘Available %s persons’; } if ( ‘Add to cart’ === $text && $product->is_virtual() ){ $translation = ‘Sign up’; } } return $translation; } ?> -
wpcf7_form_elements
Contact Form 7 change text of select include_blank
/** * Customize the default option selected on CF7 */</span> <span class=”hljs-function”><span class=”hljs-keyword”>function</span> <span class=”hljs-title”>my_wpcf7_form_elements</span>(<span class=”hljs-params”>$html</span>) </span>{ $text = <span class=”hljs-string”>’—'</span>; $html = str_replace(<span class=”hljs-string”>’—‘</span>, $text , $html); <span class=”hljs-keyword”>return</span> $html; } add_filter(<span class=”hljs-string”>’wpcf7_form_elements'</span>, <span class=”hljs-string”>’my_wpcf7_form_elements'</span>); Source: https://stackoverflow.com/questions/26902160/contact-form-7-default-option-print-as-selected-value-in-mail