add_filter(‘manage_posts_columns’, ‘reorder_admin_columns’); function reorder_admin_columns($columns) { $n_columns = array(); $move = ‘author’; // Column to move $before = ‘title’; // Move before this column foreach($columns as $key => $value) { if ($key == $before) { $n_columns[$move] = $move; } $n_columns[$key] =…Continue reading
class Protected_User { // Select capabilities from the default ‘Administrator’ role public function __construct() { add_filter(‘editable_roles’, array($this, ‘filter_editable_roles’)); add_filter(‘map_meta_cap’, array($this, ‘filter_map_meta_cap’), 10, 4); } // Remove ‘Administrator’ role if the current user is not a protected user public function filter_editable_roles($roles)…Continue reading
/** * Shane Cakes – Complete WooCommerce Account Dashboard (With Animated Delivery Bike Tracking) */ // 1. Keep default menu structure intact add_filter( ‘woocommerce_account_menu_items’, ‘shane_custom_my_account_menu_order’ ); function shane_custom_my_account_menu_order( $menu_links ) { return $menu_links; } // 2. Hook directly…Continue reading
use Elementor\Controls_Manager; use Elementor\Group_Control_Background; function add_background_and_overlay_to_layout_tab($element, $args) { // === NORMAL BACKGROUND === $element->start_controls_section( ‘custom_background_layout’, [ ‘label’ => __(‘Background (Layout Tab)’, ‘textdomain’), ‘tab’ => Controls_Manager::TAB_LAYOUT, ] ); $element->add_group_control( Group_Control_Background::get_type(), [ ‘name’ => ‘custom_background’, ‘label’ => __(‘Background’, ‘textdomain’), ‘types’ => [‘classic’,…Continue reading
/** * Protect Elementor Forms */ add_action( ‘elementor_pro/forms/validation/email’, function( $field, $record, $ajax_handler ) { // validate email format if ( ! is_email( $field[‘value’] ) ) { $ajax_handler->add_error( $field[‘id’], ‘Invalid Email address, it must be in the format [email protected]’ ); return;…Continue reading
// Prevent new plugin installations but allow updates to existing plugins add_filter(‘user_has_cap’, ‘prevent_plugin_installation_for_all_users’, 10, 4); function prevent_plugin_installation_for_all_users($allcaps, $cap, $args, $user) { // Prevent plugin installation for all users if (isset($args[0]) && $args[0] === ‘install_plugins’) { $allcaps[$cap[0]] = false; } //…Continue reading