Add Users and Plugins to admin bar

function custom_admin_bar_links($wp_admin_bar) { // Check if the current user has the ‘manage_options’ capability if (!current_user_can(‘manage_options’)) { return; // Exit if the user is not an administrator } // Add a link to the ‘Plugins’ admin page $wp_admin_bar->add_node(array( ‘id’ => ‘admin-bar-plugins’,…Continue reading

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 3 – javasrcipt

jQuery(document).ready(function($) { $(‘#duplicateNamesContainer’).on(‘click’, ‘.duplicate-name’, function(e) { e.preventDefault(); // Prevent default anchor behavior var firstName = $(this).data(‘firstname’); var lastName = $(this).data(‘lastname’); // Ensure the admin URL is correctly prefixed for your WordPress installation var adminUrl = ‘‘; // Construct the search…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