skip to Main Content

I have a client that keeps dragging the editor panels out of order (sometimes while also collapsing them) and even if I keep rearranging them for her, she keeps complaining that "Wordpress is broken". She just doesn’t get how to work with them while editing products.

enter image description here

I have searched the internet far and wide and saw no topics on this.

I want to either:

  • find a solution (or plugin) to PIN the panels in place so they cannot be moved/reordered
  • DISABLE the panel controls altogether (move arrow, drag area, collapse arrow) in a way that cannot be overwritten by WP updates

Thanks for all the help.

2

Answers


  1. Chosen as BEST ANSWER

    So I managed to disable dragging, with the help of ChatGPT. Still needs testing in other admin areas, but for now it does the trick.

    Disabling the dragging and reordering controls for the editor panels in WordPress can be achieved by using custom JavaScript to disable the drag-and-drop functionality. Here's a step-by-step guide on how to do this:

    Create a Custom JavaScript File: In your theme directory, create a new JavaScript file named disable-drag.js. Add the following code to disable-drag.js:

    jQuery(document).ready(function($) {
      $('.meta-box-sortables').sortable({
        cancel: '.postbox'
      });
    });
    

    Enqueue the JavaScript File in the Admin Area: Go to your functions.php file. Add the following code to enqueue the script:

        // DISABLE DRAGnDROP IN WP ADMIN
        function disable_drag_and_drop_script() {
        wp_enqueue_script('disable-drag', get_template_directory_uri() . '/disable-drag.js', array('jquery'), null, true);
        }
        add_action('admin_enqueue_scripts', 'disable_drag_and_drop_script');
    

    Save Changes Test the Changes: Clear your browser cache or use a hard refresh (Ctrl + Shift + R or Cmd + Shift + R on Mac).

    Go to any editor panel in the WordPress dashboard, such as the post or page editor. Check if the drag-and-drop functionality is disabled.

    If this still doesn't work, there might be other scripts or plugins that are conflicting or overriding our custom script. In that case, you might need to investigate further or consider using a plugin to manage user roles and capabilities, which can provide more granular control over the WordPress admin area.

    NOTE: pay attention to where you put the JS file and if the path is correct, otherwise you will not see effects until you check your console and see that the JS file cannot be found.


  2.     function wpturbo_disable_metabox_dragging() {
            wp_deregister_script( 'postbox' );
        }
        add_action( 'admin_enqueue_scripts', 'wpturbo_disable_metabox_dragging' );
    

    este codigo desregistra el script que permite mover los widgets del escritorio, es mas facil y no ocasiona problemas, ademas combinalo con css para evitar que se muestren los elementos innecesarios

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search