6 Great PHP code snippets for WordPress

When creating a WordPress website (like this one), I like to have some parts to work differently from default. For instance, you can’t use Gutenberg in WooCommerce, which means a description has the same boring thing as the next WooCommerce website. But there’s a way to enable this. Therefore you’ll need code snippets.

Code snippets are (mostly small) pieces of code that can be copied and pasted to work on any website. These usually go into your child themes function.php. Now the issue I’ve with this, is that you’ve to create a child theme every time you change the theme (or that’s how it was) and you don’t have easy access to different kinds of code snippets to enable/disable them temporarily. No, you have to (un)comment them in the php code.

A plugin called code snippets fixes those issues and the best thing is, it’s free!

Useful WordPress admin PHP code snippets

Infinite media library scrolling


add_filter( 'media_library_infinite_scrolling', '__return_true' );

Useful WooCommerce PHP code snippets

Gutenberg for Woocommerce product pages


Move add to card button underneath the price for Woocommerce product pages


Make Woocommerce product not purchasable


Disable description/editor for Woocommerce products


Remove excerpt/short description in WooCommerce product archive


Techies Review