Wordpress Tips & Tricks

Wordpress Tips & Tricks

There are times when you would like to remove the Category base altogether for your Category archive page URL.

I prefer this when using a custom WordPress permalink structure of /%category%/%postname%/

There are several plugins (Yoast SEO) that will do this for you.

Dont forget to flush permalinks! Be sure to flush your permalinks each time you make changes to your WordPress URL structure. It’s not always needed, but can help. To do that, go to Settings > Permalinks and click Save Changes.

SQL: Delete all images from image library

DELETE FROM etkwp_postmeta WHERE post_id IN (SELECT id FROM etkwp_posts WHERE post_type = 'attachment');
DELETE FROM etkwp_posts WHERE post_type = 'attachment'

Attach / unattach images to posts

If you want images to be auto-removed on post deletion, use plugin Autoremove Attachments.


WordPress Bash Magic |


wp-config.php

WordPress constants overview - WP Engineer

A Guided Tour of WordPress’s wp-config.php File 10 wp-config Tweaks To Improve Your WordPress Site New wp-config Tweaks You Probably Don’t Know - Tuts+ Code Article

define( ‘CORE_UPGRADE_SKIP_NEW_BUNDLED’, true );

Conquering the wp-config.php File - 11 Good Practices

define(‘DISALLOW_FILE_EDIT’,true);

Warn that deprecated WPLANG constant will be ignored

10 Things you did not know about WordPress - Remkus de Vries

Override Wordpress Site URL With wp-config.php


Import & Export Menus

Ancient plugin is still working as expected, as explained here.

Better debug and error logging

Function wp_debug_mode() is defined inside wp-includes/load.php, it is called only once in wp-settings.php. It doesn’t do nothing special.

Still, it is impossible to override it from wp-config.php as it always sets some value. The only way to change error_reporting is inside mu-plugins folder.

How can I stop PHP notices from appearing in wordpress? - Stack Overflow PHP error_reporting Predefined Constants

Log viewers and monitors:


Custom sortable columns: here


WordPress loading sequence

WordPress loading sequence: A guided tour - webdesign defunkt.nu filters - What is the very earliest action hook you can call? - WordPress Development Stack Exchange Between functions.php, widgets and plugins, which is loaded first? - WordPress Development Stack Exchange

Must use plugins are plugins that you won’t manage through the normal plugin admin screens. They are useful if you are building an application in which it makes no sense that end users would enable/disable parts of the application.

Another use for must use plugins is a plugin that loads before all other plugins, because the normal plugins are only loaded further on in wp-settings.

After loading the must use plugins, you get the earliest hook you can call: muplugins_loaded - Note that there still are no ‘normal’ plugins loaded at this point. It is the first do_action inside wp-settings.php.

add_filter( 'option_active_plugins', array( $this, 'do_disabling' ) );
add_filter( 'site_option_active_sitewide_plugins', array( $this, 'do_network_disabling' ) );

add_action(‘muplugins_loaded’, function () { // your code here });

date 01. Jan 0001 | modified 28. May 2021
filename: Wordpress - Tips & Tricks