How can I remove “Proudly powered by WordPress” from twentyeleven without modifying footer.php?

How can I remove “Proudly powered by WordPress” from twentyeleven without modifying footer.php, and without creating a child theme?

I’m looking for a php command, such as add_action, remove_action, add_filter, or something of that sort.

I’m not looking for CSS to hide the footer.

I don’t want to modify any of the theme files other than functions.php

Is this possible? For reference the code in the footer that is creating this is below.

<div id="site-generator">
    <?php do_action( 'twentyeleven_credits' ); ?>
    <a href="https://wordpress.stackexchange.com/questions/47468/<?php echo esc_url( __("http://wordpress.org/', 'twentyeleven' ) ); ?>"
    title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentyeleven' ); ?>"
    rel="generator">
    <?php printf( __( 'Proudly powered by %s', 'twentyeleven' ), 'WordPress' ); ?></a>
</div>

1 Answer
1

There are 3 methods.

  1. Somewhat weird but since this text is internationalized you can filter the output. This is just an example to remove the text, the link is still present in the source.

    add_filter('gettext', 'remove_powered_by', 20, 3);
    
    function remove_powered_by( $translated_text, $untranslated_text, $domain ) {
    
        $custom_field_text="Proudly powered by %s";
    
        if ( !is_admin() && $untranslated_text === $custom_field_text ) {
            return '';
        }
    
        return $translated_text;
    }
    
  2. Use jQuery (or javascript)

    $('#site-generator').remove();

  3. Create a child theme and just comment out the code or delete it.

Leave a Comment