• 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

Error log file by date with hash

February 2, 2020

// Get stored hashes. $error_log_hashes = get_option( 'error_log_hashes' ); // Get today's date. $date = date('Y-m-d'); // Check if …

Continue Reading

Error log files by date name

February 2, 2020

ini_set( 'error_log', WP_CONTENT_DIR . '/debug-' . date('Y-m-d') . '.log' ); …

Continue Reading

Run WordPress in debug mode without access to wp-config

January 9, 2020

add_action( 'template_redirect', 'my_enable_debug_mode' ); function my_enable_debug_mode() { // Turn on error reporting. …

Continue Reading

Compare versions in WordPress

December 17, 2019

/** * Use PHP's version_compare() to check the version * of WordPress (or a plugin or theme for that matter). * * Get currently …

Continue Reading

Enable error logging in wp-config.php

December 5, 2019

/** * The WP debug constants. * * These are used in wp-config.php to enable debugging. * * NOTE all of these MUST be inserted in …

Continue Reading

Error log utility function

December 5, 2019

/** * Writes string, array, and object data to the WP error log. * * To use, pass the result to write to the log as follows: * …

Continue Reading

Call a shortcode function by tag name

December 3, 2019

/** * Call a shortcode function by its tag name. * * Directly executes a shortcode's callback function using the shortcode's * tag …

Continue Reading

Display a WordPress login form

October 21, 2019

$args = array( 'echo' => true, 'redirect' => 'https://wpbitz.com', 'form_id' => 'loginform', 'label_username' => __( …

Continue Reading

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 4
  • Page 5
  • Page 6

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

  • Add a Database Connection to use WPDB
  • 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

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