Register Now


Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Add question


Register Now

Thank you for registering with WPTricks

How-to Add A Custom Function To Your WordPress Website

How-to Add A Custom Function To Your WordPress Website
More info:

Thanks for joining me on another WP crafter video and in this video on the show you something that is typically technical and a little challenging and not newbie friendly at all phenomena make a newbie friendly easy for you now I got a request from one of the viewers of this YouTube channel asking me about how to get a feature added back into their e-commerce their WooCommerce base websites that WooCommerce decided to remove and it was more specifically the additional shipping options in the shopping cart and so I did a little googling for her and the solution is to add a custom function so I thought this would be the perfect video for anyone that needs static custom function that they found somewhere on the web but they just don’t know how to do it okay so that’s working to do in this video so anyways this is the site that I found on a worthy page account on WordPress’s website about the custom function it’s right here so what I wanted to do is not a copy and paste it on the go here in jump into one of my WordPress installations are working to add a plug-in now you don’t necessarily need a plug-in at all to add a custom function but there is a plug-in that makes it a lot easier for you the other option is to directly get into the theme template files okay so that’s a little technical mumbo-jumbo and most people be afraid to mess something up see probably don’t want to go that route and also if you added to a themes file what happens if you change themes you would lose all your custom functions will have to going to retrieve mom and migrate them so there is a plug-in based solution that makes it real easy so when you log into WordPress go to plug-ins and then click on add new and working to do a quick search for custom functions custom functions discredited hit enter and this is the plug-in right here it’s called my custom functions I guess you could just search for my custom functions and to go and click on install to very light weight plug-in in order to go ahead and activate the plug-in alright so if you scroll down here to my custom functions you can click on settings and it will take you right into the plug-in or you can find it by going underneath appearance and then words his custom functions it says right here enter your custom functions here so now let’s go back into that page that I found this custom function that can be added and it’s right here go ahead in the highlights and I’m going to copy the function of just putting it in my clipboard you can right-click and copy it or however you like to put text in a clipboard go back here only click into the section where you can enter it I’m going to go to a
and then I’m just gonna paste it in and then put a
right there so what you do is just go ahead and copy and paste your function in there and then click this button right here on the right this is update custom functions now what I like about this plug-in is we can see right here is his custom function updated successfully the scary part about custom functions is if there is anything wrong with how it’s entered in like say right here you got this this; in this bracket if any little thing is missing if you take your whole site down doesn’t break in the entire site like there’s some devastating damage done but you have to get in and remove that custom function or fix it in order for your site to come back up so that is one of the scary spots however with this plug-in if you enter in an error so say I get rid of this is; which is not it’s it’s improper Andy go ahead and click on update custom functions now normally this would crash your entire site but check this out and gives you a nice little warning it says sorry but your custom coast the code cause a fatal error so it’s not applied please check the code and try again so we were just adding that into the theme files directly there was there’s no checking to make sure that you entered it right in it

How-to Add A Custom Function To Your WordPress Website

Please watch: “How-to Make A WordPress Website 2016 In 60 Minutes – Business or Restaurant, Create Build Develop”


All of my opinions in this video are my own, I was not paid to make this video. Whenever there is a link in any of my videos, if there is an affiliate program available, it’s safe to assume that you are clicking on an affiliate link. Please check my website for any associated bonus I may be offering, for supporting me, or ask in the comments below.

Comments ( 37 )


  2. Wow 3 years later and this tutorial saved me from having a panic attack lol. Thank you so much for sharing your knowledge.

  3. Hi Adam, interesting videos ! I wonder if you do have a video about the the_content function error with elementor / oceanwp theme? I'm not technical at all and all on their help page doesn't seem to work ๐Ÿ™ Can you help us?

  4. What if I want to add a custom function that has no relation to any other plugin.. for example a program I coded in JavaScript

  5. Thank you for your explanations, clear and easy to understand even for non-english natives. Thank you.

  6. The plugin mentioned prevented me access to the website after running a simple woocommerce function. Beware!!!!

  7. I want to add download button, download page and app details table by defult in my Android wp site.. Any one help me plz

  8. How to solve this problem
    woocommerce function.php error a nun numbaric value

  9. This is great, BUT BE CAREFUL GUYS!!

    I also had a mistake in my code and could not open wordpress nor my website. You will get an Error 500! So I had to debug wordpress so that I could deactivate this plugin. Then it worked again.

    Maybe you should make a video: How to degug WOrdpress^^

  10. Just discovering your videos recently. Very useful stuff, even this one that is well over two years old. I am particularly keen on Beaver builder and your reviews on the builders ing general. Thank you for what you are sharing it has made a huge difference in my work!

  11. Thank you. That was bezerkely helpful – just what I needed to know, simply explained.

  12. I used this plug-in now my site doesn't work at all…

  13. Here's another excellent plugin for adding functions – Code Snippets ( each snippet is a separate entry that you can apply different settings to, such as: activate/deactivate, import/export, execute frontend/backend

  14. Adam,It was really helpful for me,
    Thank you.

  15. It didn't warn me about a fatal error and now my site is broken and I have no idea how to fix it ๐Ÿ™

  16. The helpful piece of information.Thank you.

  17. A little confused about custom function. 1- how do I use a custom function on a certain page not the entire site? Do I call that function on that page. Example: I make a table in the database and and need to query it on a a page. Example code would be great with video. Thanks

  18. You are so helpful it's not funny. Thank you so much for the help

  19. Hi there:-)
    I have a website on wordpress and I would really need some help. Im looking after a requeste a quote plugin one that u can upload images to it also.. Do you know anything similar to that?
    Thanks in advance:-)

  20. Is there a way that I can get a drop down list to show only if the user selects from another drop down list
    So if I have sizes of something and if they can pick from just say 3 sizes but if they choose large or something it would show another drop down list that says pick a color
    Im guessing this is in woocommerce YES I am VERY new to this wordpress site lol

  21. Thank you for a very informative video. I have a problem in that I get the message come up: you must call the_content function in the current template. Before I got this message I stupidly changed my wp url in the general settings my removing the wp at the end of my url name in the hope it would change my web address to a .com and not a .com/wp as it is now. I managed to retrieve my site by going into the permalinks section and changing my url back to .com/wp. I now can access my site but no links are working and when I use Elementor it comes up with an error message telling me I need the_function code.
    Now that I have added this plugin I know I can add the code but can you tell me please what code I should add.
    Thank you for your help.

    All the best from sunny Thailand

  22. Hi, I used this plugin with storefront theme (no child theme). It worked perfectly with the first piece of code i added, but when I added a second piece of code the whole page crashed and i couldn't even log into the dashboard. I had to retrieve everything via cpanel. Luckily the plugin support in is really good so I solved it easily, but everytime I add a line of new code the page crashes. What am I doing wrong? How do I add new code? Thanks

  23. Hello, this is very interesting. To use this plugin, should the child theme be removed? Also, this may be a crazy question, but what happens if the plugin becomes abandoned or no longer updated?

    Thank You.

  24. hello sir,
    thanks for your previous suggestions.
    sir i have to create a job portal website on wordpress with a free t heme.
    can u help me to create the same.please release a video on how to make a jobportal as soon as possible.thanks in advance

  25. Hi, I am using wordpress to create and edit a specific page within a wordpress site. I was using elementor and everything was going fine until I overstepped the theme boundary and now it will not let me use element or because it says I need to call 'the_content' <?php the_content(); ?> but I have no idea how to do that.. I tried installing this plugin but it recognized what I pasted here as fatal. pls help, its for work

  26. I just downloaded Elementor but when I try to use it I keep getting an error as follows: "Sorry, the content area was not found in your page. You must call
    the_content function in the current template, in order for Elementor to work on this page."
    I am using the Hestia Theme in WordPress.

  27. Great! We now know how to add a custom function! ๐Ÿ™‚
    However, I still do not know how to call that function from a specific page… ๐Ÿ™

  28. Helpful video BUT adding a custom function this way did bring our site down after all and without any warning!
    Here is the code we added: dd_filter( 'tribe_rsvp_email_recipient', '__return_empty_array' );
    Message says site "is currently unable to handle this request. HTTP ERROR 500." and also brought down the site. Can you see the problem with it? We did try removing the semi-colon as you had done in your video in case it helped, but it didn't.

  29. whats with the 1 finger salute in your pics?

  30. You're very good at teaching!

  31. Duudeee. Sooo helpful. I really neede this for my Web Design class, you truly saved me man.
    Greetings from Honduras!!!!

  32. I am getting this error:
    Sorry, but your code causes a "Fatal error", so it is not applied!
    Please, check the code and try again.

  33. I want to add countto.js java script to tesseract theme but I dont know how to do it. Please help.

  34. Hi, I Am looking for a popup plugin, that can ask for visitors phone number on my website and mail the details to me.i am looking for a free one as i couldn't afford any paid plugins at the moment. or can we add a custom function of popup in our theme so that we can use it on our website.
    could you help me with that.

Leave a reply