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.
I just learned how to create a
.pot from https://wordpress.stackexchange.com/a/169282/33599
Checkout WordPress development branch via SVN which has a script for creating .pot file.
svn co http://develop.svn.wordpress.org/trunk wordpress-svn
php wordpress-svn/tools/i18n/makepot.php wp-plugin PATH_TO_PLUGIN PATH_TO_PLUGIN/language/PLUGIN_NAME.pot
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
If you see the following text,
Sorry, you are not allowed to access this page. after logging into WP admin.
Then you might have change the database prefix. Usermeta table contains
Where the prefix
bz_ is the database prefix specified in
Proof from the source code at https://github.com/WordPress/WordPress/blob/dd46042e3c3b43c5ee3c17862213b0280fb5abfd/wp-includes/class-wp-user.php#L787
Handy cleanup SQL for WordPress database.
Now I know why every Automattician should start with happiness engineering. After helping out on WP.org 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.
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)
For import from one WordPress install to another multiple database connection comes handy. The trick is instantiating a new wpdb with different database credentials.