add_action(‘wp_dashboard_setup’, function() { wp_add_dashboard_widget( ‘custom_widget_welcome’, ‘Welcome’, ‘custom_dashboard_widget_welcome_display’ ); }); function custom_dashboard_widget_welcome_display() { $current_user = wp_get_current_user(); $display_name = esc_html($current_user->display_name); // EDIT SITE SPECIFIC DETAILS BELOW echo ‘ ‘; echo ‘ Hi ‘ . $display_name . ‘ 👋 ‘; echo ‘ Here…Continue reading
// Restrict access to Docs page function restrict_page_to_logged_in_users() { // EDIT SITE SPECIFIC PAGE ID HERE $restricted_page_id = 390; // Check if the current page is the restricted page and if the user is not logged in if (is_page($restricted_page_id) &&…Continue reading
// Add Menu Link add_action(‘admin_menu’, ‘add_docs_link’); function add_docs_link() { add_menu_page( ‘Documentation’, // Page title (not used, but required) ‘Documentation’, // Menu title (shows in admin sidebar) ‘edit_posts’, // Capability required ‘docs-redirect’, // Unique slug ‘redirect_to_docs’, // Callback function ‘dashicons-editor-ul’,// Optional…Continue reading
function wpb_remove_schedule_delete() { remove_action( ‘wp_scheduled_delete’, ‘wp_scheduled_delete’ ); } add_action( ‘init’, ‘wpb_remove_schedule_delete’ );Continue reading
/** * Snippet Name: Show ‘NEW’ Badges for Recently Added Items in WooCommerce * Snippet Author: wdxtechnologies.com */ // Show the NEW badge on the archive loop item add_action( ‘woocommerce_after_shop_loop_item_title’, ‘ecommercehints_product_archive_new_badge’, 1 ); function ecommercehints_product_archive_new_badge() { global $product; $days_to_show =…Continue reading
/** * Validação completa para produtos WooCommerce * Verifica preço, categoria, referência (SKU) e peso */ function validar_produto_woocommerce_completo($post_id) { // Verifica se é um produto if (get_post_type($post_id) !== ‘product’) { return; } // Verifica se está salvando o produto (não…Continue reading
define( ‘DUPLICATOR_CAPABILITIES_RESET’, true );Continue reading
$admin_role = get_role(‘administrator’); $admin_role->add_cap(‘export’, true);Continue reading
add_action(‘init’, function () { add_rewrite_rule(‘^oh-dear-health/?$’, ‘index.php?health_check=1’, ‘top’); add_rewrite_tag(‘%health_check%’, ‘1’); }); add_action(‘template_redirect’, function () { if (get_query_var(‘health_check’) == ‘1’) { /* $token = $_GET[‘token’] ?? ”; if ($token !== ‘ma_clé_super_secrète’) { status_header(403); echo json_encode([‘error’ => ‘Unauthorized’]); exit; } */ header(‘Content-Type: application/json’);…Continue reading
function remove_cat_cap_editor () { $role = get_role(‘editor’); $role->remove_cap(‘manage_categories’); // $role->add_cap(‘manage_categories’); } add_action( ‘admin_init’, ‘remove_cat_cap_editor’ );Continue reading