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

wpcanyon.com

Tag: WordPress

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

Fix ‘The link you followed has expired’ (WordPress uploads)

Posted on August 19, 2025August 19, 2025 By Admin No Comments on Fix ‘The link you followed has expired’ (WordPress uploads)

Fix ‘The link you followed has expired’ (WordPress uploads)

If you encounter the error message “The link you followed has expired” when uploading media or themes in WordPress, it usually means your server’s PHP settings are too low to handle the upload. This guide provides a quick fix to resolve this issue by increasing the PHP limits that control upload size and script execution time.

Quick Fix

  1. Increase the upload_max_filesize and post_max_size values in your PHP configuration.
  2. Increase the max_execution_time and max_input_time values to allow longer script processing.
  3. Restart your web server or PHP service to apply changes.

Why this happens

This error occurs because WordPress relies on PHP settings to manage file uploads and script execution. When you upload a file that exceeds the limits set by upload_max_filesize or post_max_size, or if the upload process takes longer than max_execution_time or max_input_time, PHP stops the process and WordPress shows this error.

Common default PHP limits are often too low for larger media files or themes, especially on shared hosting environments. Adjusting these values allows WordPress to handle bigger uploads and longer processing times.

Step-by-step

1. Locate your PHP configuration file (php.ini)

Find the php.ini file on your server. Its location depends on your hosting environment:

  • On many Linux systems: /etc/php/7.x/apache2/php.ini or /etc/php/7.x/fpm/php.ini
  • On cPanel servers: Use the MultiPHP INI Editor or check public_html/php.ini
  • On local setups: Check your PHP installation folder

2. Edit the php.ini file

Open the php.ini file with a text editor and update or add the following lines:

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
max_input_time = 300
memory_limit = 256M

Explanation:

  • upload_max_filesize: Maximum allowed size for uploaded files.
  • post_max_size: Maximum size of POST data allowed.
  • max_execution_time: Maximum time in seconds a script is allowed to run.
  • max_input_time: Maximum time in seconds a script is allowed to parse input data.
  • memory_limit: Maximum amount of memory a script may consume.

3. Restart your web server or PHP service

After saving the changes, restart your web server or PHP service to apply the new settings.

  • For Apache:
  • sudo systemctl restart apache2
  • For Nginx with PHP-FPM:
  • sudo systemctl restart php7.x-fpm
    sudo systemctl restart nginx

4. Verify changes

Create a phpinfo.php file in your WordPress root directory with the following content:

<?php
phpinfo();
?>

Access it via your browser (e.g., https://yourdomain.com/phpinfo.php) and confirm the new values for upload_max_filesize, post_max_size, max_execution_time, and max_input_time.

5. Remove the phpinfo.php file

For security reasons, delete the phpinfo.php file after verification.

Alternative: Using .htaccess (Apache only)

If you cannot access the php.ini file, you can try adding these lines to your WordPress root .htaccess file:

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
php_value memory_limit 256M

Note: This method only works if your server allows overriding PHP settings via .htaccess. It does not work on Nginx or LiteSpeed servers.

Works on

Server Type Supported Method
Apache (cPanel, Plesk) php.ini, .htaccess
Nginx php.ini (no .htaccess support)
LiteSpeed php.ini (may support .htaccess depending on configuration)
Shared Hosting php.ini (via control panel or MultiPHP INI Editor)

FAQ

Q1: I increased the limits but still get the error. What else can I try?
Check your theme or plugin conflicts by disabling them temporarily. Also, verify your hosting provider does not enforce hard limits beyond your control.
Q2: Can I increase these limits via wp-config.php?
No, PHP upload and execution limits must be set in the server’s PHP configuration or .htaccess (Apache only). wp-config.php cannot modify these settings.
Q3: What if I don’t have access to php.ini or .htaccess?
Contact your hosting provider to increase the PHP limits or use their control panel tools like MultiPHP INI Editor.
Q4: Is it safe to increase these limits?
Yes, but avoid setting excessively high values as they can affect server performance or security. Use reasonable limits based on your needs.
Q5: How do I know the current PHP upload limits?
Create and access a phpinfo.php file with <?php phpinfo(); ?> and look for <
…
Fixes & Errors

Posts pagination

Previous 1 … 3 4

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