Use the code LAUNCH at checkout and get 20% off our limited lifetime plans. Offer available until August 1st.

5 useful WordPress Code Snippets on the WPCodeBox repository

Blog5 useful WordPress Code Snippets on the WPCodeBox repository

A WordPress code snippet is a small bit of code that has been designed to be copied and pasted, usually into a plugin or theme. They can be very useful for speeding up development time and making sure we're using the same logic over and over again. They allow us to bypass the repetitive process of writing a lot of lines of code each time

WPCodeBox provides a WordPress code snippet repository, where you can find tried and tested code snippets that you can add to your site using one click.

Here are a few useful ones:

1. Enable maintenance mode

During website repair, maintenance mode allows you to display a user-friendly notification to your visitors instead of a broken site.

It also enables you to safely carry out any maintenance tasks while ensuring that those who require access to the website do so.

To quickly put your WordPress site in maintenance mode for users who are not administrators, just download and enable this snippet from the WPCodeBox Code Snippet Repository. 

2. Remove the trash button from the posts and pages lists

When dealing with a WordPress site, the trash button in the article list has no confirmation, which means you, or worse, your clients might mistakenly click it.

This snippet, while enabled, will hide the “Trash” link from the posts or pages lists, so your clients would need to go to the edit post or page section to actually send a post to trash.

3. Delete the orphaned product variations from your WooCommerce site’s database

When maintaining a WooCommerce store, you will definitely end up having orphaned product variations in the database. These are product variations that have no parent product. These variations can cause problems when exporting or importing products, and they can slow down your site.

You can run this Code Snippet from our Repository manually, and it will delete all the orphaned product variations.

4. Add duplicate button to the post management table

Many people, especially the ones who are not familiar with WordPress or have not been using it for a long time, find it frustrating to edit posts. It is even more frustrating to discover that they've just made a mistake and need to do something over. The “Duplicate” link will make the post-management table more intuitive for them as well as their content management process.

This snippet will add a “Duplicate” link to the posts table and add this button next to each post title. 

5. Add Google Tag Manager Code to your WordPress site

If you work with WordPress, the Google Tag Manager might be a useful tool for you. It will allow you to track all your website's events in one place.

This snippet will allow you to install Google Tag Manager on your WordPress site and how to set up an event tracking code. Read more about how easy it is to add Google Tag Manager to your WordPress site using WPCodeBox.

These are just a few of the useful WordPress Code Snippets you can find on the WordPress code snippets repository.

Give WPCodeBox a try, and simplify your WordPress stack.

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram