Get wp-content/uploads files from live site on localhost

While modifying clients WordPress sites I don’t download the uploads directory contents so to avoid 404s in Chrome’s Developer Tools console I modified .htaccess to redirect those URLs to the live site. Tested in a docker container.


How to create .pot file from source code

I just learned how to create a .pot from

Checkout WordPress development branch via SVN which has a script for creating .pot file.

cd /tmp
svn co wordpress-svn
php wordpress-svn/tools/i18n/makepot.php wp-plugin PATH_TO_PLUGIN PATH_TO_PLUGIN/language/PLUGIN_NAME.pot

makepot.php help

Usage: php makepot.php PROJECT DIRECTORY [OUTPUT]

Generate POT file from the files in DIRECTORY [OUTPUT]
Available projects: generic, wp-frontend, wp-admin, wp-network-admin, wp-tz, wp-plugin, wp-theme, glotpress, rosetta, wporg-bb-forums, wporg-themes, wporg-plugins, wporg-forums, wordcamporg

Sorry, you are not allowed to access this page after wp-admin login

If you see the following text, Sorry, you are not allowed to access this page. after logging into WP admin.
Screen Shot 2017-08-27 at 17.30.52

Then you might have change the database prefix. Usermeta table contains

Where the prefix bz_ is the database prefix specified in wp-config.php

Proof from the source code at

What contributing to WordPress taught me

Now I know why every Automattician should start with happiness engineering. After helping out on forums, #wordpress IRC channel (now Slack) and contributing to WordPress Core they better understand the real user needs/problems. This problem solving hugely helped me with learning. Support has more real life scenarios that I can come up during learning. Hello world examples are too simple to acquire experience.

Wanna get better, then first try helping others. Best way to create outstanding software. At the end the end user is the consumer of the software so it should serve him and for that the developer should know the struggles of the user.

I also found some similar thoughts in the How WordPress Taught Me To Be a Better Developer blog post.

SQL to get WooCommerce product categories (terms)

For an import script I needed to get WooCommerce product categories so I ended up looking the generated query in /var/log/mysql/query.log for get_the_terms($postID, ‘taxonomy_name’)

I ended up using the following SQL query to get product categories:

SELECT t.*, tt.*
FROM wp_terms AS t 
INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id 
INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
WHERE tt.taxonomy IN ('product_cat') AND tr.object_id IN (11448)