Disable Console Logs

$isProduction = true; $triggerWords = [‘.loc’, ‘localhost’, ‘.local’, ‘staging.’, ‘.staging’, ‘.testing’, ‘.dev’]; // edit triggerWords for your setup, these as fairly standard identifiers of non production env // the goal is to check the root url for a string that…Continue reading

Delete unconfirmed users after 30 days

function spammersdeletion() { global $wpdb; $from = strtotime(‘-30 day’, time()); $wpdb->query(‘DELETE FROM wp_users WHERE DATE(user_registered) < "'.date('Y-m-d', $from).'"AND user_status = "2"'); } add_action('init','spammersdeletion');Continue reading

Admin/Floating Toolbar

/** * Create a secondary admin toolbar in the top right with integrated plugin/users search * * @author mccannex * * Changelog * 2024-08-01 – Fixed issue with crashing admin backend because WP core changed priority on certain hooks *…Continue reading

Create List of Child Pages

function wpb_list_child_pages() { global $post; // Only get child pages of the current page $args = array( ‘post_type’ => ‘page’, ‘posts_per_page’ => -1, // get all child pages ‘post_parent’ => $post->ID, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’ ); $child_pages =…Continue reading

Get Blog Info

/** * Function that returns a value from the get_bloginfo() function with a prefix, suffix, and separator. * * @param string $blog_info The blog info to be retrieved. Example: ‘name’, ‘description’, etc. * @param string $prefix The prefix to add…Continue reading