Do not ever use the guid element for creating links – ever – ever

I was recently (I always seem to start posts with that phrase) learning how to update a clients posts post_title, slug (aka post_name in the db) and guid when a post title was changed programatically. I was using get_sample_permalink() in combination with wp_update_post() to generate a permalink and update the post guid along with the … Continued

At rest

A momentary rest, sitting diagonally across the bed from the lamp; on, cover askew. Rumpled blankets catch and shade the light with their landscape. Things at rest reflecting their suchness and I momentarily knowing. And then the child coughs and the child cries which is apparently, too much for before toes and hands rise to … Continued

Force Post Author Comments to Moderation in WordPress

By default in WordPress when an author of a post comments on their own posting the comment is automatically approved. This makes sense when authors are associated with the site, have access to admin, etc. There are cases where content from the general public is used to create posts and while the user is logged … Continued

Always Unset Values Passed by Reference in a Loop

I’d always read to unset the variables passed by reference in PHP’s foreach loop. Here’s an example: foreach ($posts as &$post) { $current_post = self::get_current_version_for_post($post->ID, true, true); $post->current_post_modified = mysql2date('U', $current_post->post_modified); } unset($post); In the above code I was looping through a set of parent posts and using a custom method to get what I … Continued