extend_user_search

function extend_user_search($wp_user_query) { if (!is_admin() || strpos($wp_user_query->query_where, ‘@’) !== false) { return; } if (empty($_GET[“s”])) { return; } global $wpdb; $search_term = sanitize_text_field($_GET[“s”]); $search_terms = explode(‘ ‘, $search_term); // Prepare the search term for a LIKE query. $search_term_like = ‘%’…Continue reading

custom_elementor_admin_logo

function custom_admin_logo() { $image_url = get_site_url() . ‘/wp-content/uploads/2024/04/elementor.png’; // Make sure the path is correct echo ” “; } add_action(‘admin_head’, ‘custom_admin_logo’);Continue reading

Check for duplicate names 2 – click handler

add_action(‘admin_footer’, ‘duplicate_names_click_handler’); function duplicate_names_click_handler() { // Only add this script on the Users page to avoid unnecessary loading on other admin pages. $current_screen = get_current_screen(); if ($current_screen && ‘users’ === $current_screen->id) : ?>Continue reading

Check for duplicate names 1 – Admin notices – RUN ONCE

add_action(‘admin_notices’, ‘check_for_duplicate_full_names’); function check_for_duplicate_full_names() { $screen = get_current_screen(); // Check if we are on the Users page if ($screen->id !== ‘users’) { return; } global $wpdb; // SQL query to find duplicate first and last names $query = “SELECT meta_value…Continue reading

to do list working

/** * Plugin Name: Shop Manager To-Do List * Description: Adds a custom to-do list feature for shop managers in the WordPress admin. * Version: 1.0 * Author: Your Name */ // Register custom post type for To-Dos function create_todo_post_type()…Continue reading

Delete Expired Coupons

// Delete Expired Coupons that have an expiration date set and are not from AutomateWoo add_action(‘delete_expired_coupons_hook’, ‘delete_expired_coupons_action’); function delete_expired_coupons_action() { $query_args = [ ‘fields’ => ‘ids’, ‘post_type’ => ‘shop_coupon’, ‘post_status’ => ‘any’, ‘posts_per_page’ => -1, ‘orderby’ => ‘date’, ‘order’ =>…Continue reading

Add Featured Image Column

add_filter( ‘manage_posts_columns’, function ( $columns ) { // You can change this to any other position by changing ‘title’ to the name of the column you want to put it after. $move_after = ‘title’; $move_after_key = array_search( $move_after, array_keys( $columns…Continue reading