📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials WordPress Development Functions.php and Hooks

Functions.php and Hooks

6 min read Quiz at the end
functions.php registers theme features and hooks — use add_action/add_filter for all customisation.

functions.php and Hooks

 'Primary Menu']);
}
add_action('after_setup_theme', 'my_theme_setup');

// Enqueue scripts and styles
function my_scripts() {
    wp_enqueue_style('my-style', get_stylesheet_uri(), [], '1.0.0');
    wp_enqueue_script('my-js',
        get_template_directory_uri() . '/js/app.js',
        ['jquery'], '1.0.0', true  // true = load in footer
    );
}
add_action('wp_enqueue_scripts', 'my_scripts');

// Filter example
add_filter('the_title', function($title) {
    return strtoupper($title);
});

// Remove unwanted output
remove_action('wp_head', 'wp_generator'); // hide WP version
Topic Quiz · 1 questions

Test your understanding before moving on

1. What is the correct hook to enqueue scripts and styles in WordPress?
💡 wp_enqueue_scripts is the proper action hook for safely adding scripts and styles to the front end.