Add a Custom Footer Text in WordPress

Jürgen H. Dec 24, 2024 Customization
How can I add my own message at the bottom of my website?
What is the PHP code snippet to insert a custom footer text in a WordPress theme's functions.php file?
Andy answered Dec 24, 2024

Adding Custom Footer Text in WordPress

Custom Code Solution

The following code uses WordPress's native wp_footer hook to add custom text to your website's footer. Add this code to your theme's functions.php file or in a site-specific plugin:

This code adds custom footer text and basic styling:

function add_custom_footer_text() {
    $footer_text = 'Your custom footer message here. © ' . date('Y') . ' All rights reserved.';
    echo '<div class="custom-footer-text" style="text-align: center; padding: 20px 0; background: #f5f5f5;">' . esc_html($footer_text) . '</div>';
}
add_action('wp_footer', 'add_custom_footer_text');

For more control over styling, add this CSS to your theme's stylesheet:

function add_custom_footer_styles() {
    ?>
    <style>
        .custom-footer-text {
            color: #333;
            font-size: 14px;
            font-family: Arial, sans-serif;
        }
    </style>
    <?php
}
add_action('wp_head', 'add_custom_footer_styles');

Alternative Solution Using Filters

If your theme supports it, you can use the wp_footer_text filter (common in many themes):

function modify_footer_text() {
    return 'Your custom footer message here. © ' . date('Y') . ' All rights reserved.';
}
add_filter('wp_footer_text', 'modify_footer_text');

Plugin Solutions

If you prefer using a plugin, here are reliable options:

  1. Footer Text - Simple plugin to add custom footer text
  2. Simple Custom CSS and JS - Adds custom HTML/CSS/JS anywhere including footer

Best Practices

  • Always escape output using esc_html() or wp_kses_post() for security
  • Use translation functions if your site is multilingual
  • Consider mobile responsiveness when styling the footer text
  • Test the footer text appearance across different themes and screen sizes