Author Archives: soulseekah

Getting error feedback from `wp_mail`

Have you ever had to debug WordPress email problems, like mail not being sent, without any apparent reason? The wp_mail function is usually used to send emails from within WordPress code. This is a pluggable function and, thus, resides in wp-includes/pluggable.php.

Debugging wp_mail in WordPress

Its default behavior prevents it from returning anything but false when sending fails for one reason or another. And that often times poses a problem when trying to debug wp_mail issues.

Continue reading



Bitfun: Popcount, Sideways sum, Hamming weight

Bitcount, popcount, sideway sum, Hamming weight

I was going through some simple coding puzzles yesterday night and became fascinated by this seemingly interesting function:

int CountBits (unsigned int x ) {
  static unsigned int mask[] = {
    0x55555555,
    0x33333333,
    0x0F0F0F0F,
    0x00FF00FF,
    0x0000FFFF
  };

  int i ;
  int shift ; /* Number of positions to shift to right*/
  for (i = 0, shift = 1; i < 5; i++, shift *= 2)
    x = (x & mask[i]) + ((x >> shift) & mask[i]);
  return x;
}

Continue reading



What `the_content` goes through

the_content is one of the most known WordPress template tags. It wraps itself around the get_the_content tag (a little lower in the source) and applies the the_content filter to it.

the_content filters in WordPress

the_content filter applies at least 10 default filter functions to the content before displaying it. WordPress post content is usually just altered here and there, not too drastically (except shortcodes, of course), and sometimes you just have to know what to expect when displaying filtered content.

Continue reading



WordPress trunk news #3

With the week almost over let’s look back into the happenings inside the WordPress trunk. Many of the features described in the series will probably end up in WordPress 3.4. Check out last week’s post if you haven’t.

WordPress Trunk News #3

Continue reading



WordPress Command Line Fun

Many of you may have already met the WordPress Command Line tool called wp-cli by @scribu, the man who eats WordPress for breakfast, but my first encounter with the tool happened a couple of days ago. I don’t know how in the world I had missed its announcement 4 months ago.

wp-cli WordPress Command Line

About the tool

The WordPress Command Line tool provides a command line interface for administrative control and management, and even installation of WordPress. The tool is written in PHP and makes use of the highly flexible and powerful PHP Command Line tools library. It requires PHP CLI SAPI to be installed on the machine, which will almost always be available if you’re running WordPress on the server.

Continue reading



This is our dog Polyushka (translates to cinnamon roll from Russian). Decided to have a shower today, after a long walk. She doesn’t like to have pictures taken, especially after a shower, but she says hello 😉

Continue reading



ELM327 to RS232 in Linux

I have been having car problems recently. However, these inspired me to dig a little into the car ECU. ECUs (engine control units) are able to give out a myriad of information, like systems’ fault codes, real-time RPM, air-flow, fuel consumption, voltage, exhaust state, and lots more. Most modern cars tap into this information and display it on the dashboard via on-board computers.

OBD2 ELM327 to RS232 Linux

I finally received the long-awaited OBD II (OBD 2) (on-board diagnostics) interpreter based on the ELM327 chip yesterday and all I can say is that it’s been a long night.

Continue reading



Another 7 Overlooked WordPress Helper Functions

In a previous post we looked at 7 Overlooked WordPress Helper Functions. Today I’ll dig deep and find more helpful undocumented functions that WordPress uses internally that can be of help when developing plugins and themes. Leveraging code that is already available in the core, is maintained and simply works can save you quite a bit of coding and debugging time.

7 More Overlooked WordPress Functions

Continue reading



The WordPress Meta “generator” Tag Paranoia

WordPress Version

…or “WordPress Version Fingerprinting”

I have read dozens of “How to secure your WordPress” articles, and one common “tip” among others is getting rid of the “generator” tag in the HTML head, for additional security through obscurity.

WordPress uses the meta “generator” tag to “disclose” its version. The paranoia surrounding this fact is unbelievable, and they think that by removing it they harden WordPress. And that is absolutely not true.

Continue reading