Block WP-Admin Area from Non-Administrators
add_action( ‘admin_init’, function() { if ( ! current_user_can( ‘administrator’ ) ) { wp_redirect( home_url() ); exit; } } );Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
add_action( ‘admin_init’, function() { if ( ! current_user_can( ‘administrator’ ) ) { wp_redirect( home_url() ); exit; } } );Continue reading
// Author: Sumaiya , Clickup Doc: https://app.clickup.com/36636088/v/dc/12y1dr-22535/12y1dr-24415 // Scoring System: 1 = Ja (Yes), 0 = Nein (No) function calculate_organ_scores($answers) { $scores = [ ‘darm’ => 0, ‘leber’ => 0, ‘nebennieren’ => 0, ‘bauchspeicheldruese’ => 0, ‘schilddruese’ => 0, ];…Continue reading
add_action( ‘admin_init’, ‘disable_tinymce_for_notifications’); function disable_tinymce_for_notifications() { if ( ( GFForms::is_gravity_page() && rgget( ‘page’ ) === ‘gf_edit_forms’ && rgget( ‘view’ ) === ‘settings’ ) && rgget( ‘subview’ ) === ‘notification’ ) { add_filter( ‘user_can_richedit’, ‘__return_false’ ); } }Continue reading
add_action( ‘add_meta_boxes’, function($post_type) { remove_meta_box( ‘wpcode-metabox-snippets’, $post_type, ‘normal’ ); }, 100 );Continue reading
/** * ShipStation Integration for WooCommerce – FINAL v5 * * – Fixes Apply Rate scope issue by making methods public. * – Ensures JS uses refreshed nonces correctly. */ if ( ! defined( ‘ABSPATH’ ) ) exit; // —…Continue reading
/** * Title: WooCommerce ShipStation Admin Rates * Description: Adds ShipStation live rates to the WooCommerce admin order screen */ // Exit if accessed directly if (!defined(‘ABSPATH’)) { exit; } class WC_ShipStation_Admin_Rates { // Store the nonce so we can…Continue reading
/** * Title: Add Percentage Discount to Order Line Items * Description: Adds percentage discount field to WooCommerce order line items in admin * Author: Claude AI * Version: 1.0 * * @package WPCode Snippets * @category Orders */ //…Continue reading
// Description: This code defines two functions to fetch tool data from the database based on a provided CLP Tool Task ID (clp_tool_task_id). It retrieves the tool_no and name_of_the_tool from the clp_test_table. Designed for integration with FlowMattic workflows to enable…Continue reading
add_action( ‘admin_head’, function () { if ( current_user_can( ‘update_core’ ) ) { return; } remove_action( ‘admin_notices’, ‘update_nag’, 3 ); }, 1 );Continue reading
add_filter(‘admin_footer_text’, function () { echo ‘ Este sitio web está siendo gestionado por Fórmula Click. Más información aquí: Mantenimiento técnico Fórmula Click ‘; });Continue reading