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:

 

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.

 

Remove menu items for non-administrators in WordPress admin

Remove menu items for non-administrators in WordPress admin by adding this to your functions.php.

 

Disable WordPress Emojis

Disable WordPress emojis and remove the annoying  inline javascript and css on your WordPress site, simply by adding this to your themes functions.php.