Execute code on create, edit or delete taxonomy terms in WordPress

 

Upload image from URL and set as featured image in WordPress

 

Sort tags and categories with ACF in WordPress

Start by adding a custom field to your tag or category with Advanced Custom Fields, name it to “custom_field” or something, and add this to your functions.php.

 

Modify the tag or category object in the loop by getting the custom field, but it back, sort it and use it how you want.

 

Get current post ancestors in WordPress

Get current post ancestors and list it’s children in WordPress.

 

MySQL queries and php load time in WordPress

Get number of MySQL queries and php load time of your theme in WordPress, by adding this last in your footer.php-file. Don’t forget to add the constant WP_ENV to your functions.php to make sure it stays in the development environment.

 

Backup your WordPress database during development with GIT

Save daily backups of your WordPress database to file during development, to store them in GIT alongside with other developers databases.

First, define the environment by adding this to your wp-config.php:

Second, paste this to your functions.php:

 

Disable flicker on elements during CSS animation or transition in Safari

Disable flicker on elements during CSS animation or CSS transition in Safari by adding this (with browser prefixes) in your CSS-file.

 

Advanced Custom Fields and GIT in WordPress

Include Advanced Custom Fields or Advanced Custom Fields Pro in your theme and save fields groups as json (pretty awesome). This will allow you to easily version control fields and fieldgroups in GIT. Just move the plugin to your theme folder, rename it to “acf” and create another folder called “acf-fields”. Paste this to your functions.php.

 

Replace non-english characters (i.e. å,ä and ö) on file upload in WordPress

Replace non-english and weird characters in file name on upload in WordPress by adding this to your functions.php.

Updated. Credits goes to http://annalinneajohansson.com/2013/10/10/rensa-specialtecken-ur-filnamn-vid-uppladdning-i-wordpress/.

Modify ACF post object result to include Polylang language in WordPress admin

Modify the result in a ACF post object field in WordPress admin by including language slug from Polylang. Instead of having multiple object with the same title (but on different languages), add this to your functions.php. Don’t forget to change “field_name” to what ever your field is called.