Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress WordPress Theme Development Working with CSS and JS in WordPress Themes How to Link to JS from functions.php File

Alexander van Ravestyn
Alexander van Ravestyn
3,403 Points

Fatal error: Call to undefined function add_actions()

Whenever I try to load my homepage, I get a fatal error telling me that I'm calling an undefined function add_actions() in my functions.php file! I have installed wordpress locally on my computer with DesktopServer like it was described to me in the "How to Install WordPress on Your Computer" course. Could that have anything to do with it?

The full error message:

Fatal error: Call to undefined function add_actions() in /Users/Alexander/Documents/Websites/unifac.dev/wp-content/themes/unifac/functions.php on line 3

Screenshot of the error message: Imgur

The code in functions.php:

    function wpu_theme_styles() {
        wp_enqueue_style('bootstrap_min_css', get_template_directory_uri().'/css/bootstrap.min.css');
        wp_enqueue_style('bootstrap_theme_min_css', get_template_directory_uri().'/css/bootstrap-theme.min.css');
        wp_enqueue_style('google_fonts', 'https://fonts.googleapis.com/css?family=Montserrat|Open+Sans|Cormorant+Garamond:700italic');
        wp_enqueue_style('main_css', get_template_directory_uri().'/style.css');
    add_actions('wp_enqueue_scripts', 'wpu_theme_styles');

    function wpu_theme_js() {
        wp_enqueue_script('bootstrap_min_js', get_template_directory_uri().'js/bootstrap.min.js', array('jquery'), '', true);

    add_actions('wp_enqueue_scripts', 'wpu_theme_js');

Thanks in advance for helping!

2 Answers

Alexander van Ravestyn
Alexander van Ravestyn
3,403 Points

Never mind! It was supposed to be add_action() instead of add_actions()! I won't forget that again ;-)

Hi Alexander,

I hope you don't mind I switched your comment to a Answer so other users can spot the error more easily :)