10 Popular WP Plugins To Delete & Replace With a Code Snippet

WPCodeBox www.youtube.com

Brief Summary

This video demonstrates how to replace multiple WordPress plugins with custom code snippets using WPCodeBox, ultimately consolidating functionality into a single, custom plugin. It covers replacing plugins for maintenance mode, custom post types, post duplication, dark mode, custom CSS/JS, comment disabling, admin bar hiding, XML-RPC disabling, WooCommerce product tabs, and "Add to Cart" button text customization. The process involves deactivating the original plugins, creating code snippets in WPCodeBox to replicate the desired functionality, and then generating a custom plugin from those snippets.

  • Consolidate WordPress functionality by replacing multiple plugins with code snippets.
  • Use WPCodeBox features like autocomplete and repository for efficient coding.
  • Generate a custom plugin from WPCodeBox snippets for streamlined site management.

Introduction

The video introduces the concept of simplifying a WordPress plugin stack by using WPCodeBox to replace multiple plugins with custom code snippets. Kevin from CodeBox explains that this approach helps reduce the number of plugins, making the WordPress site more efficient and manageable. The video will guide viewers through replacing ten popular WordPress plugins with WPCodeBox.

Maintenance plugin

The video demonstrates how to replace a maintenance mode plugin using WPCodeBox. First, the existing maintenance plugin is deactivated. Then, a new snippet is created in WPCodeBox with code that redirects users to a maintenance page if they are not logged in or cannot edit themes. Two methods are shown: one using wp_die() to display a maintenance message and another redirecting to a specific maintenance page. The second method involves creating a maintenance page with a specific ID and setting up a redirect in WPCodeBox.

Custom post types plugin

The video explains how to replace a custom post type plugin, such as Advanced Custom Fields (ACF), CPT UI, or Pods, with code in WPCodeBox. The existing plugin is deactivated, and a new snippet is created to register a custom post type called "rooms." The video suggests using GenerateWP or WP Cody (an AI code generator for WPCodeBox users) to generate the code for the custom post type. The generated code is then pasted into a WPCodeBox snippet, activated, and the new custom post type appears in the WordPress admin menu.

Duplicate posts plugin

The video demonstrates how to replace a duplicate post plugin like "Yoast Duplicate Post" with a snippet from the WPCodeBox repository. The existing plugin is deactivated, and a duplicate post snippet is imported from the WPCodeBox repository. After enabling the snippet, a "duplicate" option appears for posts, allowing users to easily clone posts.

Add supports to CPT

The video addresses the issue of missing featured images in the custom post type. It explains that the custom post type needs to declare support for certain features like title, content, featured image, and author. The video uses WP Cody to generate the necessary code to add support for these features to the custom post type. The generated code is then added to the WPCodeBox snippet, and the featured image option becomes available in the custom post type.

Dark mode plugin via WPCode

The video explains how to implement dark mode functionality by replacing a dedicated dark mode plugin. The existing plugin is deactivated, and the video uses the dark mode library. It involves creating three snippets in WPCodeBox: one for enqueuing the dark mode JavaScript file, one for the JavaScript code itself, and one for CSS to handle potential z-index issues and image inversions. The JavaScript snippet includes code to toggle dark mode, and the CSS snippet addresses image display issues in dark mode using mix-blend-mode.

Simple custom CSS and JS

The video demonstrates how to replace a simple custom CSS and JS plugin, which is used for adding code snippets like Google Tag Manager. The existing plugin is deactivated, and a Google Tag Manager snippet is imported from the WPCodeBox repository. The Google Tag Manager code is added to the header and footer sections of the snippet, and the snippet is activated, thus replacing the functionality of the original plugin.

Disable comments plugin

The video explains how to replace a disable comments plugin with a custom snippet in WPCodeBox. The existing plugin is deactivated, and a new snippet is created to disable comments for all post types and remove the comment form. The snippet includes code to remove comment support for all post types and a filter to prevent the comment form from being displayed.

Hide admin bar plugin

The video demonstrates how to replace a hide admin bar plugin using a snippet from the WPCodeBox repository. The existing plugin is deactivated, and a snippet to remove the admin bar for all users (or all except administrators) is imported from the WPCodeBox repository. The snippet is activated, and the admin bar is hidden on the front end.

Disable XML-RPC-API plugin

The video explains how to disable XML-RPC using a simple code snippet in WPCodeBox, replacing a dedicated plugin. The existing plugin is deactivated, and a new snippet is created with a filter to disable XML-RPC. This helps prevent excess traffic and potential security vulnerabilities.

Product tabs plugin

The video demonstrates how to replace a product tabs plugin with a custom snippet in WPCodeBox. The existing plugin is deactivated, and a new snippet is created to add a custom WooCommerce product tab called "package details." The video uses WP Cody to generate the code for the custom tab, which retrieves data from a custom field. The code is modified to use a "what you see is what you get" field, and the tab is updated with custom information.

Add to cart custom text

The video explains how to customize the "Add to Cart" button text by replacing a dedicated plugin with a custom snippet in WPCodeBox. The existing plugin is deactivated, and a new function is added to the WooCommerce snippet to change the "Add to Cart" text to "Select Package." A filter is used to apply this function to the WooCommerce product single add to cart text.

Replace WPCodeBox

The video demonstrates how to generate a plugin from the created snippets within WPCodeBox. The "Generate Plugin from Snippets" option is used to create a new plugin with a specified name, description, author, and version. All the relevant snippets are selected, and a plugin file is generated. WPCodeBox is then deactivated and deleted, and the newly created plugin is activated, ensuring that all the custom functionality remains intact and is now contained within a single, custom plugin.

Summarize any YouTube video in seconds

Get summaries like this one for any video, in your language, with the free Summ app.

Download on the Apple Store
Get it on Google Play

Transcript

Full transcript of “10 Popular WP Plugins To Delete & Replace With a Code Snippet”. Click a timestamp to open the video at that moment. Need another video? Use the YouTube transcript generator.

0:00 get rid of 10 popular WordPress plugins and simplify your WordPress plugin stack using codebox my name is Kevin from codebox and today we're excited to show you how you can simplify your WordPress plugin stack using WP code box okay here's our first victim the maintenance plugin we currently have our site in maintenance mode and we have this nice fancy maintenance plugin we're going to get rid of it and use WP code box so let's deactivate the plugin let's go to WP code box and we're going to create a new snippet called maintenance now we're going to show two different codes that you can use for your maintenance mode first we're going to start with ADD action and as you can see right here WP code box has an autocomplete function that can be used for any WordPress function or custom

0:47 functions that you add in WP code box and we'll see that later so let's go ahead and autocomplete this we'll set add action we're going to use the template redirect action and we're going to add a custom function here called never more maintenance mode Let's close that and now let's create our function so as we said before WP code box has autocomplete features we added this function up here before so now when we type it down here when we start typing never more we'll see that the function already comes up and we can just go ahead and hit enter to keep moving on to the rest of our code so now we're going to say if current user can edit themes we're actually going to say

1:33 if the current user cannot edit themes or the current user is not logged in we are going to fire the maintenance mode so a simple way is to just use WP die and we'll go ahead and add some code here and we're just going to add some text here for what our maintenance mode error will say on the front end and we'll set the page title and we'll say under construction so let's save this and now let's activate our first snippet let's go back to the front end and refresh the page and we'll see we have our maintenance mode that we're

2:19 currently updating the site and we can see up here under construction is our page title now let's look at a different way to do this in this example we're not going to use WP die we're going to use something else so we're going to create a new variable called maintenance ID and we're going to set this to 286 and this 286 is going to correspond to the page number that we're using so let's go and look at our pages and right here we see we have a maintenance mode page with an ID of 286 it's currently drafted so let's go ahead and publish it and let's view the page on the front end so we see we have a nice currently under construction let's go back to the page and since we're using break dance we're just going to go ahead and set the

3:05 template to no header or footer we don't want the users to be able to access anything else we just want them to see this page so there we have a basic easy maintenance mode page now let's go back to WP code box and as we mentioned before this is the page ID that we just looked at and so let's continue with our code we're going to say if we're not currently the maintenance page we're going to redirect the users to that page and now we're going to exit so let's save this and now let's go ahead and make sure that we as users can still log into the front end there we go we can and let's make sure that a guest cannot okay so they see currently under

3:52 construction let's go ahead and try and go to the homepage and we'll see that it still redirects them to the maintenance mode page so now we have a nice maintenance mode page that we can control fully with our Builder our theme whatever we're using and now we're going to go on to our next fixum which is our custom post types in this example we're using Advanced custom Fields but you might be using another plugin such as cptu or pods or anything else so let's deactivate that and we're going to create our own rooms custom post type so let's go back to WP code box and we're going to create a new snippet called Rooms CPT and let's save this and now there's multiple ways that you can create your custom postype you can do it all by hand or you can use a website such as generate WP generate WP

4:38 allows you to use the post type generator to create your own custom post type and you can fill in all this information and hit the update code and it will output some values for you another option is to use WP Cody WP Cod is a free resource for WP code box users that you can use to write custom code with AI so let's go ahead and create a new snippet so we're going to say create a custom post type called rooms with the singular name room the CBT slug should be room and the labels should also reference room or rooms accordingly prefix the function with

5:25 Nevermore and any text domains should also be never more place the CPT below comments in the admin panel and use the dash Aon so let's really quickly let's go look at what dashon we want to use we want to use this network key so let's paste this in and now let's generate our snippet so we have a quick correction here we used never instead of Nevermore let's go ahead and change that and let's check for anything else before we generate at looks pretty good otherwise so let's regenerate this okay and this time it's a little bit smaller which might actually be

6:11 better because it's just less code to right let's go back into WP code box let's paste our code in let's save it and now let's enable it and refresh the page and down here we see we have our rooms CPT with the previous rooms we already had with Advanced custom Fields now let's go to our next plugin that we're going to get rid of and in this case it's going to be duplicate posts uh EOS duplicate post is a very popular one and it has a lot of functionality here like clone new draft rewrite and republish we don't need all of that we just need a basic clone so let's deactivate y duplicate posts let's go back to WP code box and in this case we're going to use the wp code box repository which has a lot of already created scripts for you that you can

6:56 just import with a click so let's look up duplicate and here we see we have the snippet already set up for us let's download that snippet and enable it now if we go back to our rooms custom post type we can see that we can duplicate any of our posts and we can update the information to whatever we want so in this case we're just going to create a new Full side queen bed and we're going to publish that and one thing to note here is we actually don't see a featured image so let's go back into our rooms custom post type and the problem is that we don't have any of the supports here so let's go back into WP Cody and we'll say

7:44 include support for the Post title post content featured image author and we'll generate that okay so right here we can see all our supports so let's just copy that one line let's go back into WP code box and paste our code in and now let's save this and if we go back to our rooms custom post typ go back to our queen bed pool side we'll now see that we have our featured image here and we can update that perfect so we've got that all set let's go look at the next plugin we're going to get rid of and in this case we're going to get rid of the wp code plugin which is currently housing our dark mode so if we

8:30 go to the front end we can see we have this nice Nifty little dark mode button here this is all done with WP code and we're using the dark mode Library so let's deactivate WP code and now let's look at how to implement dark mode so if we look here we can see there's a bunch of information here about how to install it and we're going to use the easy way using JS Delver so let's copy this right here and now let's go back to WP code box and we're going to create a new snippet and we're going to call this dark mode PHP now what we're going to be doing here is we're going to be enqing the dark mode JS script so let's go function Nevermore inq dark

9:15 mode and we're going to say WP and Q script and we're going to call this script dark mode JS and the script URL is the script URL we just copied and we're going to finish off this code here and the next thing we're going to do is we're going to add an action to call this code so let's do WP and Q scripts there we are and our function is going to be Nevermore in Q dark mode now let's save this and activate it along with the PHP we also need to create JavaScript so let's go to a new snippet and we're going to call this dark mode JS and our type we're actually going to change to JavaScript so let's create a JavaScript and save that and let's go back to dark mode JS and what

10:02 we need to do is essentially just add this code right here so let's copy that let's go back to WP code box and paste it in now we want to do one more thing I'm going to change this to Dom content loaded because in this instance it works a little better with breake dance you may be able to get away with using load but you'll just have to test it out and see what works best for you so let's save this and now let's activate it so we have our dark mode PHP we have our dark mode JS let's go ahead and refresh the page and we can see the dark mode button is here but it's currently not working and that's because we have a zindex issue so let's go back to code box let's create a new snippet and now we're going to call this dark mode CSS and we're going to change our type to a

10:47 CSS file with that set let's go ahead and look at what dark mode says about this if we come down here we can see this debug and they're talking about using it for debug but we're just going to borrow this code and use it for our Z index issue and we're going to paste it right in we're going to save it and enable it now if we refresh the page and we click the dark mode button we can see that it is working but we still have a problem with our images they now look really weird and inverted so let's deactivate this and let's look at what dark mode says again and we can see up here we're talking about override Styles uh and they recommend using mix blin mode difference on some things so let's go back to our CSS and now we're going to add some new code we're going to say dark mode activated image so any image

11:35 element we're going to do this for and we also added another class in our Builder called Dark mode keep so we've Now set that for both of these selectors we're now going to use mix blend mode difference okay so let's save this let's go back to our front end and refresh it and now if we click dark mode we should see that our images are correct for both the background images and for our regular images so we now have dark mode working and everything looks great we've gotten rid of another plugin while we're on the process of custom code let's go ahead and look at the simple custom CSS and JS plugin we're currently using this for a header and footer now I know you may be

12:21 thinking you already had WP code light installed and activated why would you use another code plugin for this but this happens a lot you'll see a lot of times that people install different code snippet plugins because they were recommended by a support team to install that plugin and activate it not realizing that a lot of these plugins do the same thing so let's take a look at the front end with our current information where we can look in the head and see that we have the simple custom CSS and JS with the Google tag manager and we can also see it here in the footer we're going to replace this with WP code box so as you can guess our first step is to go to our plugins page and disable that plugin next we are going to go to WP code box and we're going to use the

13:06 snippet repository and we're going to look up Google tag okay so here's our Google tag code manager we're going to download that snippet and we're just pasting in our Google tag code whatever your Google tag code is that's what you're going to paste in right here you're just going to copy it directly from Google add it to your header and to your footer then you're going to save it and activate it and now if we refresh the front end we'll see that we have our Google tag code here we'll see that it also exists in the footer here and we've just replaced another plugin let's go ahead and get rid of all the other utility plugins that we're using let's go back to plugins and we'll come down to the disable comments plugin and we're going to go ahead and deactivate that let's go to our posts and view one of the posts

13:53 on the front end and then I'll go ahead and go back to WP code box while that's loading and let's go ahead and look here let's turn off dark mode and if we come down here we can see that there is a comment box to leave a reply and add a comment we're going to get rid of this by creating a new snippet called disable comments and there's two things we want to add here the first is we want to disable comments for all our post types and the second is we want to remove the comment form because of the way that some Builders and themes work removing the comment form is necessary because the code doesn't always register the you have disabled comments so we're going to do both just to make sure everything is safe so let's start out with our new function we're going to say never more disable comments actually let's make it

14:39 a little more specific so we're going to say never more disable comment support now we're going to say post types is get post types and we're going to Loop through each of these so for each post types as post type we're going to remove post type support report for that post type we're going to remove comments okay so next we're going to do add action andit and never more disable comment support okay so that removed comment support now we're going to remove the comment form so function never more disable comment form and all we're going to say here is return false nice and easy so add filter

15:27 and we're going to say comments open right down here we are going to say never more disable comment form and we'll set the priority and the arguments and we'll save this and now let's go ahead and enable it and look at our post on the front end and we'll see that comments are now disabled for that post type and actually all of our post types comments are now disabled so that's great let's go ahead and look at the next plugin we're going to get rid of and the next one is going to be the hide admin bar based on user rules let's go ahead and deactivate that now and we'll see if we go to the front end and refresh the page we'll now see that the admin bar is up here let's go back to WP code box and again we're going to use the snippet repository for this and we're going to say admin actually let's be a little more specific let's say remove admin and we

16:13 can see that there's two different Snippets available the first returns false for all users so nobody will see the admin bar the second one returns false for all users except the administrator most likely you would choose this one but in this example we're going to disable it for everybody so let's go ahead and download the snippet let's enable it and now let's refresh the front end and we can see the admin bar is gone again so let's go back to WP code box and get rid of our next plugin which in this case is disable xmlrpc we're going to go ahead and deactivate that and this is another one line of code that is very easy to do let's create a new snippet called disable XML RPC and we're just going to say add filter XML RPC

16:59 enabled and we're going to return false so with that we've disabled xmlrpc this isn't a function that you can really see on the front end but it does help to prevent a lot of excess traffic or even malicious attempts to hack onto your site so unless you have a reason to have xmlrpc enabled it's a really good idea to have it disabled okay let's go back to our plug-in list and look at our next victim we've cleaned up pretty much everything our last two victims here are going to be the product tabs and the add to cart button custom text so let's go and look at our products right now and let's look at the family adventure we have a custom product tab here with some package detail information and we're going to get rid of that so let's go back to WP code box actually let's go to

17:44 our plugins list and we're going to come down here and deactivate this and now let's go to WP code box and create a new snippet called wo Commerce and we'll save this next we're going to go back to WP Cody for this because there's a lot of code that we need to write and this just makes it a lot easier so let's go down here we're going to delete all of this we're going to leave this prefix information because we want that to stay the same and we're going to say create a custom woocommerce product tab called package details and have it return data from the custom fields and in this case we're using the same custom field that our plugin that we just deactivated was using you may

18:29 choose to create your own custom field and use that information instead but let's just go ahead and see how this does right now let's go ahead and generate this okay so now we have our information here and this should be pretty good to use so let's copy this let's go back to WP code box and paste in our code now if we activate this okay so this is our product page let's go ahead and look at the product on the front end and we can see our package details here and it's still loading the data that we had before now let's go back to WP Cody and we're going to update this again and we're going to say create a custom field called WPT field package details for the Post type product this is a what

19:17 you see is what you get field okay so now let's copy this let's go back to WP code box and paste it in let's save this and then go ahead and look at our product on the back end so we now see that we have the product description and we have our product details and looks like this is what we want but we actually want to change this product details to say we want this to say package details okay so let's save this refresh it and now if we add some custom information here let's say great for everyone with x inform let's update this and look at it on the front end and we

20:03 can see that the information correctly updated and our custom Tabs are still showing so we've successfully created our own product tab with our own custom fields and the last thing we want to do is change this add to cart button custom text it's currently saying book now we don't want to use that anymore uh so we're going to deactivate the add to cart button custom text plugin we'll refresh the page and now we can see that it says add to cart we don't want it to say that either so let's go ahead and go to our woocommerce snippet and we're going to add another function down here called never more single add to cart and we're going to say return select package and the package text domain is going to be Nevermore and we'll add another filter for the Wu

20:50 Commerce product single add two cart texts and we're going to call that function never more single add to cart so let's save this let's view our page on the front end and now it's back to select package and with that update we have now done all the changes that we wanted to do to our website now for our last trick we're going to replace WP code box so within WP code box there's this option here to generate plugin from Snippets we're going to click that we're going to set the plug-in name to Nevermore the plug-in description to Hotel never more functionality plug-in author plug-in version and let's select all of our

21:36 Snippets I we actually not do the maintenance mode and then we'll click generate plugin from selected Snippets and we'll save this into our folder now with that downloaded let's go to plugins now let's go and deactivate WB code box and then we'll add a new plugin we'll upload the plugin we just created and let's go back to installed plugins now in our case it's very important to make sure you have WP code box deactivated before you activate Nevermore otherwise you're going to have dual functions so with that deactivated let's activate never more and we can see that we have our rooms available that we just had

22:24 before we can go to the front end and see that the abmin bar is missing we can see dark mode is working so this looks pretty good everything's working and the last thing we can do is we can actually deactivate and delete WP code box so that way nobody can mess with our Snippets that we just put together

Share

More video summaries