Snippets Archive

Codes that are meant to be useful for others. Commercial use of my code strictly prohibited.

How to bring Link Manager back in WordPress

If you choose to create a new database and perform a fresh WordPress install process on your web server, you will notice the installation scripts creates a "wp_links" table on your database ...

Using Auto Draft Posts

There's no doubt that WordPress uses "Autosave" feature for some pretty valid reasons and it is very useful in certain scenario ...

Query WooCommerce Products

There are multiple ways you can query WooCommerce products in WordPress. Though generally you can use the native get_posts function, it is recommended to use the WooCommerce native wc_get_products function ...

Check if WooCommerce is Active

Over the past couple of years, I have written and shared number of snippets on WooCommerce which I hope helped some of you ...

Removing Block Editor Stylesheet

Last year when WordPress 5.0 came out, I wrote a simple post showing how to continue using Classic Editor on your WordPress site ...

Adding Custom Structured Data in WooCommerce

By default WooCommerce adds structured data for every single published product in JSON format. It is a great feature which not only helps the search engines to crawl important information about a product but it also helps with the overall SEO (Search Engine Optimization) strategy of an WooCommerce based eCommerce site ...

Get your Classic WordPress Editor Back

WordPress just released it's latest version (5.0) today which is being widely discussed because some of it's major "improvements" ...

Regex for Twitter Username in PHP

Recently I was working on a project where I had to come up with a solution to validate twitter username before I allow users to insert the data into my database ...