• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP Bitz

A curated collection of code snippets for WordPress

  • Home
  • About
  • Blog
  • Code Snippets
You are here: Home / Archives for Code Snippets

Restrict WordPress login by IP address

October 1, 2020

/** * The following will restrict login to a * specific IP address. * * Change "111.111.111.111" to the actual IP. */ add_action( …

Continue Reading

Add cc and bcc to wp_mail() headers

September 28, 2020

$headers[] = 'From: Some One '; $headers[] = 'Cc: cc_number_1@email.com'; $headers[] = 'Cc: cc_number_2@email.com'; $headers[] = …

Continue Reading

Random Number Generator

September 4, 2020

/** * Generates a random number of a fixed number of digits. * * The use of STR_PAD_LEFT allows the result to ALWAYS be the given …

Continue Reading

Remove WP emoji scripts from header

July 12, 2020

/** * This snippet removes the WP emoji code from the WP header. */ remove_action( 'wp_head', …

Continue Reading

Remove WP emoji code from site header

June 24, 2020

/** * The following removes the WP emoji code from your site's header. * * Note the priority "7" for the wp_head remove action. This …

Continue Reading

Shortcode to display list of categories

June 18, 2020

/** * This creates the [my_cat_list] shortcode. * * The shortcode will display a list of categories. * * @link …

Continue Reading

Decrease Password Strength Requirements for WooCommerce

June 17, 2020

/** * Change WooCommerce required password strength. * * WooCommerce password strength requirement is determined by an integer …

Continue Reading

Remove WooCommerce Password Strength Meter

June 17, 2020

add_action( 'wp_print_scripts', 'my_woo_remove_password_strength', 10 ); function my_woo_remove_password_strength() { …

Continue Reading

Set user role to WordPress default role during WooCommerce checkout

May 28, 2020

add_filter( 'woocommerce_new_customer_data', 'my_custom_user_data'); function my_custom_user_data( $new_customer_data ) { …

Continue Reading

  • « Go to Previous Page
  • Page 1
  • Page 2
  • Page 3
  • Page 4
  • Page 5
  • Page 6
  • Go to Next Page »

Primary Sidebar

Join for free!

Get free code snippets, WordPress best practices, and practical Content Marketing advice from seasoned WordPress expert Chad Butler (butlerblog):

Recent Posts

  • Notice: Function WP_Block_Patterns_Registry::register was called incorrectly
  • Use WP-CLI to back up your site
  • Bitnami WordPress Autoptimize cannot write to the cache directory
  • Create and delete WordPress sites in XAMPP with a batch file
  • How to fix “Error: MySQL Shutdown Unexpectedly” in XAMPP control panel

Copyright © 2025 · Maker Pro on Genesis Framework · WordPress · Log in