Category Archives: WordPress
The "Content Blocks: Advanced" repository has an example of the absolute minimal code you need to build a custom block, and progress from there.
Minimal CacheStorage API Example
It's not easy to find examples of using the
CacheStorage
API outside of service workers, or with the `await` operator, so I put one together. Preventing a Tragedy of the Commons
Dries Buytaert wrote a compelling article on the challenges that large open source projects like Drupal and WordPress face in seeking to be sustainable, and preventing a tragedy of the commons, where large corporations use open source software without giving back.
Programmatically Adding Comment Metadata from JavaScript
Creating comment meta from a client side script isn't as easy as it is on the PHP side, but it can be done.
Prevent Manual Admin Notices From Being Moved to the Top
WordPress normally moves all elements with a
notice
style to the top of the page, but that can be prevented with the inline
CSS class. Gutenberg and WordCamp.org’s Shortcodes
Corey McKrill presented a case study at WordCamp Portland about the process we went through to build Gutenberg blocks for WordCamp.org.
Setting up WordPress Multisite with SSL on DreamHost
Setting up a Multisite instance on DreamHost isn't as easy as it should be if you want to also have SSL certificates, but it's possible with the right settings.
Guest on Hallway Chats
Tara Claeys and Liam Dempsey have a really interesting podcast where they talk to people in the WordPress community about what it means to be successful.
Moving a Theme Between Theme Roots
WordPress allows you to have multiple theme directories, but moving themes from one to another may result in a fatal error. It's possible to fix that by updating a few options and clearing a transient.
Inspiration
"Even though we might have some very, very strong disagreements as we develop this thing called WordPress, at the end of the day, I think we all agree that when it impacts people's lives positively like that, it's really really special."
Exposing Custom Post Type Meta for Only a Single API Endpoint
I ran into an undocumented and unexpected problem when registering custom post type meta fields for the REST API.
register_meta()
exposes meta fields in all REST API endpoints, which can lead to privacy leaks. To avoid that, it can be called conditionally.
`WP_Widget::form()` returns a value
Ever wonder why your IDE complains that your widget's
form()
method isn't returning a value? Accessing Post Meta and More Via $post->meta_key
It turns out there's a much better way to fetch post meta than
get_post_meta( $post->ID, 'foo', true )
: $post->foo
. Using git-svn to Manage Plugins in the WordPress.org Repository
Unfortunately, the WordPress.org plugin repository doesn’t provide a way to maintain your plugin with Git. In the past, I’ve either just used Subversion, or hosted an extra copy on GitHub, and setup Git and SVN side-by-side in the same directory. Awhile ago, I briefly considered using git-svn, because it would allow me to avoid using Subversion entirely, […]
Finding all Sites That have a Plugin Active
I wanted to find out which sites in a Multisite network had a certain plugin active, but couldn't find an existing solution I was happy with. So, I wrote a WP-CLI command to do the job.
Rename WordPress’ Database Prefix with WP-CLI
I wanted to update the database prefix one this site, but most of the tutorials out there have you do it manually. There are some plugins available, but I didn’t trust most of them, and the ones that I did were kind of bloated with other features, and I didn’t want to mess with the […]
WordCamp Seattle 2016 Call for Speakers
We’ve opened the call for speakers for this year’s WordCamp Seattle. Give it a shot if you have any ideas, best practices, use cases, or stories you want to share with the community. I think people are often hesitant to put themselves out there, and that’s definitely understandable, but the WordPress community is really welcoming, and I think […]
Regolith
I just finished the first version of a new WordPress installation template called Regolith. I’ve been using my personalized fork of Mark Jaquith’s WordPress Skeleton for the past several years, but recently came across Bedrock and really liked it. I started playing around with it, but quickly discovered that the tools and practices it embraced were a bit overkill for […]
Generating Dynamic Placeholders for $wpdb->prepare()
$wpdb->prepare() is often called with each un-sanitized value explicitly passed as an individual argument; for example: $wpdb->prepare( "SELECT id FROM wp_posts WHERE id > %d AND `post_status` = %s", $min_id, $status ) The function will also accept an array of un-sanitized values, though, like this: $wpdb->prepare( "SELECT id FROM wp_posts WHERE id > %d AND […]