When the url of a published post is updated in WordPress, the previous url slug is saved into a meta key called _wp_old_slug and a 301 redirect is created automatically. In most cases this is exactly what you would want to happen, but there are rare cases where it can cause a problem.
I hit an odd edge case when upgrading to WordPress 4.4 on WP Engine. At some point the slugs for two WooCommerce products had been swapped, so the _wp_old_slug for ‘product-1’ was ‘product-2’, and ‘product-2’ was ‘product-1’. This should have caused an infinite redirect immediately, but for some reason those rules were ignored until the WordPress 4.4 upgrade. Continue reading →
Command line scripts can be excellent tools for fetching and quickly parsing data from an external API.
I recently wrote a script that allows you to search Zendesk tickets for a specific query term, and then returns a list of all associated e-mails. It’s something that’s impossible to do through the Zendesk UI (without a ton of clicking and copying), but really useful.
Sometimes it’s really useful to be able to output HTML in the Customizer that’s not a label or description for a specific control. You may want to output a line break, an image, a button, or simply some additional text.
There isn’t a native Customizer control in WordPress to do this, but you can add your own custom control to output arbitrary HTML. This was a request for the Customizer Library, and the GitHub issue explains the thought process behind the code. Continue reading →
Broad Experience is a podcast I listen to regularly. It’s a thoughtful interview show about the experience of women in the workplace.
One recent episode mentioned the lack of women in tech, which hits close to home (87% of of people who follow me on Twitter are male). It’s a complex issue and there’s no quick panacea, but there is at least one easy step companies can take recruit more female engineers: remove requirements from a job description that aren’t actually requirements.
“There’s been research that shows many women will only apply for a job if they meet 100% of the qualifications,” said Erik Michaels-Ober of Soundcloud. “Whereas men will do so even if they meet some smaller percentage. They’re willing to put themselves out there even if they’re not fully qualified.”
“So we looked at a lot of things,” said Erik. “For example, having a college degree was a requirement on a lot of our jobs. But when we looked internally, we realized had hired a lot of male engineers who didn’t have a college degree because they had decided to apply anyway.” Continue reading →
One common use case for theme authors might be to add a documentation link or an upsell link so users can find out about theme features.
The approach I like the best is one I first saw employed by the Theme Foundry with their theme “Make”. Their upsell link is prominent, but it doesn’t detract too much from the theme customization experience or take up too much space in the limited UI.
This tutorial takes a similar approach, but shows how to add a styled link to the “Active Theme” section. Continue reading →
I had a number of questions about the themes on WordPress.org, so I ran the script this morning a slurped all the themes. It took 112 minutes to run and downloaded nearly 4GB of theme code. Here’s what I found out. Continue reading →
I’ve been working on a new theme that allows users to select certain pages in the customizer, and then display those pages out on a “showcase” template. I think this is pretty useful functionality and wanted to share how I implemented it.
Add Settings, Controls and Sanitization
First, we’ll need to the page select boxes to the customizer. In the code below, I add a new customizer section called “Showcase”. Then, I loop through the add_setting / add_control functionality in order to display four distinct page select boxes.
I’ve also created a function called “prefix_get_pages_array” which returns an array of all the pages to be used both by the controls and the sanitization function. You’ll notice it sorts the pages alphabetically, and indents sub-pages slightly with an em dash when output in the select box. Continue reading →