Category Archives: Code Snippet

Hide the Admin Bar in WordPress

Once we start membership integration, adding non-admin users, the admin toolbar seating on top of the page for logged in users becomes annoying. The toolbar for regular user such as subscriber provides only links to edit profile or link to log out. A fully customized membership website should has other options to provide these links. In almost all my projects, clients want to hide it from regular users.

Continue Reading →

WooCommerce: Disable Product Review Tab

When working with plugin like WooCommerce, it is hard to avoid customization, a lots of it. In my recent project, I adopted WooCommerce to achieve product management without shopping cart experience. You guessed it, disable and hide so many options.

As it is just a product showcase, review is not required on single product detail page. There are actually two ways to disable the reviews tab.

Continue Reading →

Limit WordPress Search Results to Certain Post Types

WordPress built-in search function searches all post types by default. Sometimes, we want to have some controls over what should be searched and what not. For example, on a blog website, I pretty much want to limit the search within “post” post type, but ignore “page”.

Continue Reading →

How to Redirect to Post if Search Result Returns Only One Match

When someone searches your blog using WordPress built-in search engine, the results are displayed as a list. Wouldn’t it be nice if we can redirect the visitor directly to the post when there is only one match in the search list? Here is a snippet can do just like that.

Continue Reading →

Troubleshooting: WordPress Contact Form Not Sending EMail

I was ready to call it a day after long hard-working hours, then a unhappy customer dropped me a bomb, “Hey, the contact form you just touched today not sending out email. Get it fixed, NOW!”. If this sounds familiar to you, then you shouldn’t be panic.

Continue Reading →

Disable WordPress Plugin Update Notification

“There is a new version of XYZ plugin available”. This message is so familiar to WordPress admin. But sometimes, we need to turn it off. For example, I just customized a plugin, and don’t want my customization code being overwritten by anyone who doesn’t know this plugin has to be remain untouched.

Continue Reading →

Insert Widget with Shortcode in WordPress

Themes are designed very differently from each other. I found myself sometimes use columns template provided by some themes to achieve sidebar like layout. As it is something like 75/25 column split, not standard widget area, inserting a widget needs bit extra work.

Continue Reading →

Seriously! How to Remove WordPress Version Number

A lot of us know that, “removing WordPress version number” is a fairly popular security trick. The purpose is to hide the WordPress version number embedded in the final rendered HTML code, so to reduce the risk of being targeted by hackers for known vulnerability.

Whether this trick has anything to do with security is still a myth, let’s take a look at how it works.

Continue Reading →