I recently ran into a situation where a WordPress Multisite install needed to have some options replicated across each site, both new and existing. It also needed to be able to override the options per site if so desired. The solution is fairly trivial. Setup the options page in wp-admin. Ensure it exists on all subsites
WordPress: Add category to permalink and redirect old permalinks
Occasionally you run across a situation where a website permalink structure needs to be changed from what it has been to a new structure. Most sites that have been public will have links to them from other websites that need to properly redirect to the new permalink structure. Removing an element from the permalink structure
MySQL: Count number of tables in database
If you need to count the number of tables that exist in a MySQL database you can do so with the following query. Just remember to swap out the database name! SELECT count(*) FROM information_schema.tables WHERE table_schema = ‘YOUR_DB_NAME’
Bash script to automatically convert git submodules to regular files
Git submodules drive me batty! They are a great idea in theory however in practical application they are a pain in the butt to work with. I have a project that has accumulated over a dozen submodules over the past couple years. Switching branches and merging anything has become excruciating. This morning was the last straw.
Reset all git submodules
Here is a quick snippet that will reset all your git submodules to their most recent commit. Handy when something has happened such as a file permissions change that unintentionally affected the submodules. git submodule foreach –recursive git reset –hard