Skip to content
  • Quick Ref
  • Contact
  • About
wpcanyon.com

wpcanyon.com

Tag: Admin

Fixing the Menu Manager Width Issue in WordPress

Posted on August 20, 2025August 20, 2025 By Admin No Comments on Fixing the Menu Manager Width Issue in WordPress

Fixing the Menu Manager Width Issue in WordPress

If you’ve ever opened the WordPress Menu Manager and found the menu editing panel too narrow or cramped, you’re not alone. This common issue makes managing menus frustrating, especially on smaller screens or with many menu items. Fortunately, fixing the menu manager width issue in WordPress is straightforward with a small CSS tweak or a plugin adjustment.

Quick Fix

  1. Open your WordPress dashboard and navigate to Appearance > Menus.
  2. Inspect the menu editor panel width using your browser’s developer tools.
  3. Add custom CSS to increase the width of the menu manager container.
  4. Save changes and refresh the menu editor to verify the new width.

Why This Happens

The menu manager width issue in WordPress usually occurs because the default admin styles set a fixed or limited width for the menu editor container. This can be exacerbated by:

  • Browser zoom levels or screen resolution constraints.
  • Conflicts with admin themes or plugins that override default styles.
  • WordPress core updates that change admin UI layouts.
  • Custom admin CSS added by themes or plugins.

Because the menu manager panel is designed with a fixed width, it doesn’t always adapt well to different screen sizes or content lengths, causing cramped or truncated menus.

Step-by-Step: Fixing the Menu Manager Width Issue

  1. Access WordPress Admin Panel
    Log in to your WordPress dashboard and go to Appearance > Menus.
  2. Inspect the Menu Manager Container
    Right-click on the menu editor panel and select Inspect or Inspect Element to open developer tools.
  3. Identify the CSS Class or ID
    Look for the container element that controls the menu manager width. Typically, this is #menu-to-edit or .menu-edit.
  4. Add Custom CSS
    Add the following CSS to your admin area to increase the width:
/* Increase WordPress Menu Manager Width */
#menu-to-edit {
    width: 800px !important;
    max-width: 100% !important;
}
  1. Apply CSS in Admin Area
    You can add this CSS using one of the following methods:
    • Use a plugin like Admin CSS MU or WP Admin UI Customize to add admin CSS.
    • Add the CSS to your theme’s functions.php file to enqueue admin styles (see code snippet below).
  2. Save and Refresh
    Save your changes and reload the Menus page. The menu manager panel should now be wider and easier to use.

Code Snippets: Adding Custom Admin CSS via functions.php

function custom_admin_menu_manager_width() {
    echo '<style>
        #menu-to-edit {
            width: 800px !important;
            max-width: 100% !important;
        }
    </style>';
}
add_action('admin_head-nav-menus.php', 'custom_admin_menu_manager_width');

This snippet injects the CSS only on the Menus admin page (nav-menus.php), ensuring no unintended effects elsewhere.

Common Pitfalls

  • CSS Not Applying: Make sure your CSS targets the correct element. IDs and classes can change with WordPress updates.
  • Plugin Conflicts: Some admin customization plugins may override your CSS. Temporarily disable them to test.
  • Screen Size Limitations: On very small screens, increasing width may cause horizontal scrollbars. Use max-width: 100% to prevent overflow.
  • Browser Cache: Clear your browser cache or use a private window to see CSS changes immediately.
  • Theme or Admin Theme Overrides: Custom admin themes may require additional CSS adjustments.

Test & Verify

  1. Open the WordPress admin menu editor on different browsers (Chrome, Firefox, Edge) to ensure consistent behavior.
  2. Test on different screen resolutions and zoom levels.
  3. Verify that the menu items are fully visible and the editing interface is comfortable to use.
  4. Check for any layout breakage or overlapping elements.

Wrap-up

Fixing the menu manager width issue in WordPress is a simple but effective way to improve your admin experience. By adding a small CSS tweak, you can expand the menu editor panel to better fit your screen and menu content. This fix works well across most hosting environments and admin setups.

Remember to test after applying changes and keep your WordPress installation and plugins updated to avoid future conflicts.

Works on

Environment Compatibility
Web Servers Apache, Nginx, LiteSpeed, IIS
Control Panels cPanel, Plesk, DirectAdmin
Browsers Chrome, Firefox, Edge, Safari
WordPress Versions 5.0 and above (tested up to latest 6.x)

FAQ

Q: Will this fix affect other admin pages?
A: No. The provided CSS targets only the menu editor page, so other admin pages remain unaffected.
Q: Can I adjust the width to a different value?
A: Yes. Change the width value in the CSS snippet to any pixel or percentage value that suits your screen.
Q: What if the menu manager is still too narrow after applying the fix?
Try clearing your browser cache, disabling conflicting plugins, or increasing the width value further.
Q: Is it safe to add CSS directly to functions.php?
Yes, as long
…
Admin & UI

Add custom dashboard widgets (useful shortcuts)

Posted on August 19, 2025 By Admin No Comments on Add custom dashboard widgets (useful shortcuts)

Add Custom Dashboard Widgets (Useful Shortcuts)

If you manage a WordPress site, adding custom dashboard widgets can greatly improve your workflow by providing quick access to important links, information, or tools right on your admin dashboard. This tutorial shows you how to create a custom dashboard widget in WordPress, making your admin area more functional and tailored to your needs.

Quick Fix: Add a Custom Dashboard Widget in WordPress

  1. Create a function to register your custom widget using wp_add_dashboard_widget().
  2. Hook this function into the wp_dashboard_setup action.
  3. Define the callback function that outputs the widget content (e.g., useful shortcuts).
  4. Place the code in your theme’s functions.php file or a custom plugin.

Why This Happens

By default, WordPress dashboard widgets display standard information like site health, quick drafts, or WordPress news. However, these widgets might not fit your specific workflow or provide the shortcuts you frequently need. WordPress provides a built-in API to add custom dashboard widgets, allowing you to personalize your admin area and improve efficiency.

Requirements

  • Access to your WordPress site’s functions.php file or ability to create a custom plugin.
  • Basic knowledge of PHP and WordPress hooks.
  • Administrator access to the WordPress dashboard.

Step-by-step: Add a Custom Dashboard Widget with Useful Shortcuts

  1. Create the widget registration function. This function will register your custom widget with WordPress.
  2. function my_custom_dashboard_widgets() {
        wp_add_dashboard_widget(
            'custom_shortcuts_widget',         // Widget slug.
            'Useful Shortcuts',                 // Widget title.
            'custom_shortcuts_widget_content'  // Display function.
        );
    }
    add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets');
  3. Define the widget content callback. This function outputs the HTML content inside your widget.
  4. function custom_shortcuts_widget_content() {
        echo '<ul>';
        echo '<li><a href="' . admin_url('post-new.php') . '">Add New Post</a></li>';
        echo '<li><a href="' . admin_url('edit.php?post_type=page') . '">Manage Pages</a></li>';
        echo '<li><a href="' . admin_url('upload.php') . '">Media Library</a></li>';
        echo '<li><a href="' . admin_url('themes.php') . '">Themes</a></li>';
        echo '<li><a href="' . admin_url('plugins.php') . '">Plugins</a></li>';
        echo '<li><a href="' . admin_url('options-general.php') . '">Settings</a></li>';
        echo '</ul>';
    }
  5. Add the code to your site. You can add this code to your active theme’s functions.php file or create a simple plugin to keep it separate from your theme.

Common Pitfalls

  • Placing code in the wrong file: Adding the code to a plugin or functions.php file of a child theme is recommended to avoid losing changes during theme updates.
  • Syntax errors: Missing semicolons, brackets, or quotes can cause fatal errors. Always test on a staging site first.
  • Widget not showing: Ensure you have administrator privileges and the code is hooked correctly to wp_dashboard_setup.
  • Conflicts with other plugins: Rarely, other plugins may deregister dashboard widgets or interfere with hooks.

Works on

This method works on any standard WordPress installation regardless of the web server or control panel:

  • Web servers: Apache, Nginx, LiteSpeed
  • Control panels: cPanel, Plesk, DirectAdmin
  • WordPress versions: 4.0 and above (recommended to use latest version)

FAQ

Q: Can I add multiple custom dashboard widgets?
A: Yes, simply call wp_add_dashboard_widget() multiple times with different widget IDs and callback functions.
Q: How do I remove default dashboard widgets?
A: Use remove_meta_box() inside the wp_dashboard_setup hook to remove unwanted default widgets.
Q: Can I add widgets for specific user roles only?
A: Yes, check the current user’s role inside your registration function and conditionally add widgets.
Q: Is it possible to add dynamic content like recent posts or stats?
A: Absolutely. Your widget callback function can run any PHP code, including queries to display dynamic data.
Q: Will this affect front-end performance?
A: No, dashboard widgets only load in the WordPress admin area and do not impact the public-facing site.
…
Admin & Blocks

Custom login logo + styles (theme‑agnostic)

Posted on August 19, 2025 By Admin No Comments on Custom login logo + styles (theme‑agnostic)

Custom Login Logo + Styles (Theme-Agnostic)

Many WordPress site owners want to replace the default WordPress login logo with their own branding. This is especially useful for client projects, membership sites, or any scenario where a custom branded login experience is desired. The challenge is to do this in a way that works regardless of the active theme — a theme-agnostic solution.

This tutorial shows you how to add a custom login logo and styles using code that you can place in your functions.php file or a mini-plugin. This method ensures your customizations persist even if you switch themes.

When to Use a Custom Login Logo + Styles

  • You want to replace the default WordPress logo on the login page with your own logo.
  • You need to customize the login page’s look and feel without relying on theme support.
  • You want a lightweight, code-based solution instead of a plugin.
  • You want to maintain branding consistency for clients or users.

Quick Fix: Add Custom Login Logo and Styles

  1. Prepare your custom logo image (recommended size: 320×80 pixels, PNG or SVG).
  2. Upload the logo to your theme or child theme folder, or use the WordPress Media Library.
  3. Add the provided PHP code snippet to your functions.php file or create a mini-plugin.
  4. Test the login page to verify the logo and styles appear correctly.

Why This Happens

By default, WordPress uses its own logo on the login page, which is hardcoded in the login form markup. To customize it, you need to hook into WordPress actions and filters to override the default styles and replace the logo URL. Since the login page is outside the theme templates, theme styles don’t apply here, so you must enqueue your own CSS or output inline styles via hooks.

Step-by-Step: Custom Login Logo + Styles Code

Below is a complete code snippet that:

  • Replaces the login logo with your custom image.
  • Adjusts the logo size and login form styles.
  • Changes the logo link URL and title attribute.
<?php
// Hook to customize login logo and styles
function custom_login_logo() {
    // URL to your custom logo - adjust path as needed
    $logo_url = get_stylesheet_directory_uri() . '/images/custom-login-logo.png';

    // Output custom CSS for login page
    echo '<style type="text/css">
        #login h1 a, .login h1 a {
            background-image: url(' . esc_url($logo_url) . ');
            background-size: contain;
            width: 320px;
            height: 80px;
            margin: 0 auto 25px;
        }
        /* Optional: customize login form background and button */
        body.login {
            background-color: #f1f1f1;
        }
        .login form {
            background: #fff;
            border: 1px solid #ddd;
            padding: 26px 24px;
            box-shadow: 0 1px 3px rgba(0,0,0,.13);
        }
        .wp-core-ui .button-primary {
            background: #0073aa;
            border-color: #006799;
            box-shadow: none;
            text-shadow: none;
        }
        .wp-core-ui .button-primary:hover {
            background: #006799;
            border-color: #005177;
        }
    </style>';
}
add_action('login_enqueue_scripts', 'custom_login_logo');

// Change the logo link URL to your homepage or custom URL
function custom_login_logo_url() {
    return home_url();
}
add_filter('login_headerurl', 'custom_login_logo_url');

// Change the logo title attribute on hover
function custom_login_logo_url_title() {
    return get_bloginfo('name');
}
add_filter('login_headertext', 'custom_login_logo_url_title');
?>

How to Add This Code

You have two main options:

  1. Add to your theme’s functions.php file:
    Open functions.php in your active theme or child theme folder and paste the code at the bottom. Save and upload.
  2. Create a mini-plugin:
    Create a new file named custom-login-logo.php in wp-content/plugins/ with the following header and the code above:
    <?php
    /*
    Plugin Name: Custom Login Logo
    Description: Adds a custom login logo and styles.
    Version: 1.0
    Author: Your Name
    */
    

    Then paste the code snippet below the header. Activate the plugin via the WordPress admin.

Testing Your Custom Login Logo

  1. Clear your browser cache or open a private/incognito window.
  2. Visit https://yourdomain.com/wp-login.php or https://yourdomain.com/wp-admin/.
  3. Verify that your custom logo appears instead of the default WordPress logo.
  4. Check the logo link points to your homepage and the title attribute shows your site name.
  5. Adjust CSS in the code snippet if the logo size or positioning needs tweaking.

Variations and Enhancements

  • Use an SVG logo: Upload an SVG file and update the URL accordingly. Ensure your server supports SVG display.
  • Load logo from Media Library: Replace $logo_url with the full URL of an image uploaded via Media Library.
  • Customize login page background: Add more CSS rules inside the <style> block to change background colors, fonts, or add custom messages.
  • Use external CSS file: Instead of inline styles, enqueue a custom CSS file using wp_enqueue_style hooked to login_enqueue_scripts.
  • Change login form elements: Use additional hooks like login_form or login_footer to add custom HTML or scripts.

Works On

<

Environment Compatibility
Web Servers Apache, Nginx, LiteSpeed, IIS
Control Panels cPanel, Plesk, DirectAdmin
…
Developer Snippets

Adding ID Field To The Media Library Listing In WordPress Admin

Posted on August 19, 2025 By Admin No Comments on Adding ID Field To The Media Library Listing In WordPress Admin

Adding ID Field To The Media Library Listing In WordPress Admin

If you manage a WordPress site with many media files, you might find it useful to see the attachment ID directly in the Media Library list. By default, WordPress does not show the media ID column, which can make referencing or debugging media items harder. This tutorial shows you how to media library show ID column WordPress with a quick code snippet you can add to your theme’s functions.php file or a small custom plugin.

When to Use This

  • You need to quickly find the attachment ID for shortcodes, custom queries, or debugging.
  • You want to improve your workflow by seeing media IDs without opening each file.
  • You are developing or managing a site with many media files and want better admin visibility.

Updated Code for Modern WordPress

WordPress has evolved, and the admin list tables now support hooks to add custom columns easily. The following code uses the manage_upload_columns and manage_media_custom_column filters to add an ID column to the Media Library list view.

Quick Fix: Add ID Column to Media Library

  1. Open your active theme’s functions.php file or create a small plugin.
  2. Copy and paste the code below to add the ID column.
  3. Save and refresh the Media Library (list view) in the WordPress admin.
<?php
// Add ID column to Media Library list view
add_filter('manage_upload_columns', 'add_media_id_column');
function add_media_id_column($columns) {
    $new_columns = array();
    foreach ($columns as $key => $value) {
        if ($key === 'title') { // Insert ID column before Title
            $new_columns['media_id'] = 'ID';
        }
        $new_columns[$key] = $value;
    }
    return $new_columns;
}

add_action('manage_media_custom_column', 'show_media_id_column', 10, 2);
function show_media_id_column($column_name, $post_id) {
    if ($column_name === 'media_id') {
        echo $post_id;
    }
}
?>

Step-by-Step: Add via functions.php or a Small Plugin

  1. Via functions.php:
    1. Access your site files via FTP or hosting file manager.
    2. Navigate to wp-content/themes/your-active-theme/.
    3. Edit the functions.php file.
    4. Paste the code snippet above at the end of the file.
    5. Save changes and upload if needed.
    6. Go to WordPress admin > Media > Library and switch to List View.
    7. You should see a new “ID” column showing the media item IDs.
  2. Via a small plugin:
    1. Create a new file named media-library-id-column.php.
    2. Paste the following code inside:
    3. <?php
      /*
      Plugin Name: Media Library ID Column
      Description: Adds an ID column to the WordPress Media Library list view.
      Version: 1.0
      Author: Your Name
      */
      
      add_filter('manage_upload_columns', 'add_media_id_column');
      function add_media_id_column($columns) {
          $new_columns = array();
          foreach ($columns as $key => $value) {
              if ($key === 'title') {
                  $new_columns['media_id'] = 'ID';
              }
              $new_columns[$key] = $value;
          }
          return $new_columns;
      }
      
      add_action('manage_media_custom_column', 'show_media_id_column', 10, 2);
      function show_media_id_column($column_name, $post_id) {
          if ($column_name === 'media_id') {
              echo $post_id;
          }
      }
      ?>
      
    4. Upload the file to wp-content/plugins/.
    5. Activate the plugin via WordPress admin > Plugins.
    6. Check the Media Library list view for the new ID column.

Step-by-Step Test

  1. Log in to WordPress admin.
  2. Navigate to Media > Library.
  3. Make sure the view mode is set to List View (not Grid View).
  4. Look for the new ID column next to the Title column.
  5. Verify the numbers correspond to the media item IDs by clicking “Edit” on a media item and checking the URL (e.g., post.php?post=123&action=edit).

Block Themes & Gutenberg Notes

Block themes and the Gutenberg editor do not affect the Media Library list table in the admin area. This code works independently of the front-end theme or editor. However, if you use a full site editing (FSE) block theme, the Media Library admin screen remains the same and will display the ID column as expected.

Common Pitfalls

  • No ID column visible: Make sure you are in List View, not Grid View. The column only appears in List View.
  • Code added but no effect: Clear any caching plugins or browser cache. Also, verify the code is in the active theme’s functions.php or the plugin is activated.
  • Syntax errors: Copy-paste carefully and ensure PHP tags are correct. A syntax error can break your site.
  • Child theme usage: If you use a child theme, add the code to the child theme’s functions.php to avoid losing changes on updates.

Why This Happens

By default, WordPress does not include the attachment ID as a visible column in the Media Library list table. The list table is customizable via hooks, but the ID column is not enabled out of the box. Adding the ID column requires hooking into WordPress filters that control which columns are displayed and what content they show.

Works On

Environment Notes
Apache, Nginx, LiteSpeed Works on all common web servers as this is a WordPress PHP hook change.
…
WordPress Snippets

Increasing The Categories Selection Height Dynamically In WordPress Admin

Posted on August 19, 2025 By Admin No Comments on Increasing The Categories Selection Height Dynamically In WordPress Admin

Increasing The Categories Selection Height Dynamically In WordPress Admin

If you manage a WordPress site with many categories, the default height of the category checklist in the post editor can feel cramped. This makes it difficult to see and select multiple categories without excessive scrolling. The quick fix is to increase the height of the category checklist dynamically in the WordPress admin area, improving usability and workflow.

Quick Fix

  1. Add a small PHP snippet to your theme’s functions.php file or a custom plugin.
  2. Use admin CSS to increase the height of the category checklist container.
  3. Test the changes by editing a post with many categories.

Why This Happens

By default, WordPress sets a fixed height (usually 150px) on the category checklist box in the post editor. This height is hardcoded via CSS and does not adjust based on the number of categories. When you have many categories, the fixed height causes a scrollbar to appear, making it cumbersome to select multiple categories quickly.

Increasing the height dynamically or setting a larger fixed height improves the user experience by showing more categories at once without scrolling.

When to Use

  • You have a large number of categories (20+).
  • You frequently assign multiple categories to posts.
  • You want to reduce scrolling in the post editor category checklist.
  • You prefer a cleaner, more accessible admin interface.

Updated Code for Modern WordPress

The following code snippet uses the admin_head action hook to inject custom CSS into the WordPress admin area. It targets the category checklist container and increases its height to 300px, which can be adjusted as needed.

<?php
function increase_category_checklist_height() {
    echo '<style>
        #categorychecklist, 
        #category-all, 
        .categorydiv .tabs-panel {
            max-height: 300px !important;
            overflow-y: auto !important;
        }
    </style>';
}
add_action('admin_head', 'increase_category_checklist_height');
?>

How to Add via functions.php or a Small Plugin

  1. Open your active theme’s functions.php file via Appearance > Theme Editor or FTP.
  2. Paste the above PHP snippet at the end of the file.
  3. Save the file.
  4. Alternatively: Create a small plugin by creating a new PHP file (e.g., increase-category-height.php) in wp-content/plugins/ with the following content:
<?php
/*
Plugin Name: Increase Category Checklist Height
Description: Dynamically increases the category checklist height in the WordPress admin post editor.
Version: 1.0
Author: Your Name
*/

function increase_category_checklist_height() {
    echo '<style>
        #categorychecklist, 
        #category-all, 
        .categorydiv .tabs-panel {
            max-height: 300px !important;
            overflow-y: auto !important;
        }
    </style>';
}
add_action('admin_head', 'increase_category_checklist_height');
?>
  1. Activate the plugin via WordPress admin > Plugins.

Step-by-Step Test

  1. Ensure you have multiple categories (20+). Add more if necessary via Posts > Categories.
  2. Edit or create a new post.
  3. Locate the Categories meta box on the right side.
  4. Verify that the category checklist height is increased (around 300px) and scrollable if needed.
  5. Try selecting multiple categories to confirm usability improvements.
  6. If the height is not applied, clear your browser cache and refresh the admin page.

Block Themes & Gutenberg Notes

In the Gutenberg (block) editor, the categories meta box is rendered differently, but the checklist container still uses similar CSS classes. The above CSS targets the classic category checklist and works in Gutenberg as well.

For block themes or full site editing, the categories panel height can still be controlled with this CSS injection. However, if you use custom block-based category selectors or third-party plugins, you may need to adjust the CSS selectors accordingly.

Common Pitfalls

  • CSS specificity: If other plugins or themes override the category checklist styles with higher specificity, your changes might not apply. Use browser developer tools to inspect and adjust selectors if needed.
  • Cache issues: Admin caching or browser cache can prevent immediate visibility of changes. Clear caches after adding the code.
  • Incorrect placement: Adding the snippet outside PHP tags or in the wrong file can cause errors. Always add inside <?php ?> tags.
  • Plugin conflicts: Some admin UI plugins may replace or heavily customize the category meta box, requiring custom CSS targeting their markup.

Works on

Environment Compatibility
Web Servers Apache, Nginx, LiteSpeed (no server config needed)
Control Panels cPanel, Plesk, DirectAdmin
WordPress Versions 5.0 and above (Classic & Gutenberg editors)
Themes Classic themes, Block themes

FAQ

  1. Q: Can I increase the height beyond 300px?
    A: Yes, simply change the max-height value in the CSS to your preferred height (e.g., 400px or 500px).
  2. Q: Will this affect the category checklist on other admin pages?
    A: The CSS targets the category checklist by ID and class used primarily on post edit screens. It should not affect other admin pages.
  3. Q: Does this work with custom taxonomies?
    A: This snippet targets the default categories taxonomy. For custom taxonomies, you may need to adjust the CSS selectors to match their meta box IDs or classes.
…
WordPress Snippets

Recent Posts

  • Top WordPress Themes for Blogs in 2025
  • WordPress Admin Panel Trick: Adding ID Field to the Posts Listing
  • Solution previous_posts_link and next_posts_link Not Working
  • Show Top Commentators in WordPress Without a Plugin
  • How to Style Admin Comments in WordPress

Recent Comments

    Archives

    • August 2025

    Categories

    • Admin & Blocks
    • Admin & UI
    • Automation
    • Automation & Plugins
    • Comments
    • Comparisons
    • Database & Revisions
    • Developer Snippets
    • Fixes & Errors
    • Media & Thumbnails
    • Queries & Pagination
    • Security
    • Speed & Security
    • Tips & Tricks
    • WooCommerce How‑tos
    • WordPress Snippets
    • WordPress Themes
    • Terms & Conditions
    • Affiliate Disclosure

    Copyright © 2025 wpcanyon.com.

    Powered by PressBook WordPress theme

    Also by the maker of MySurveyReviews.com