Change WordPress Meta Widget

Want to change your meta links contained in a WordPress sidebar widget?

Meta Link

[2.9] If you are trying to edit the meta data that appears in the sidebar of your WordPress blog, such as removing the RSS links, find this code in /includes/default-widgets.php file and remove/comment the unwanted lines.

This is what the original class looks like:

class WP_Widget_Meta extends WP_Widget {

	function WP_Widget_Meta() {
		$widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") );
		$this->WP_Widget('meta', __('Meta'), $widget_ops);
	}

	function widget( $args, $instance ) {
		extract($args);
		$title = apply_filters('widget_title', empty($instance['title']) ? __('Meta') : $instance['title']);

		echo $before_widget;
		if ( $title )
			echo $before_title . $title . $after_title;
?>
			<ul>
			<?php wp_register(); ?>
			<li><?php wp_loginout(); ?></li>
			<li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php echo esc_attr(__('Syndicate this site using RSS 2.0')); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
			<li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php echo esc_attr(__('The latest comments to all posts in RSS')); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
			<li><a href="http://wordpress.org/" title="<?php echo esc_attr(__('Powered by WordPress, state-of-the-art semantic personal publishing platform.')); ?>">WordPress.org</a></li>
			<?php wp_meta(); ?>
			</ul>
<?php
		echo $after_widget;
	}

And this is my modified one:

class WP_Widget_Meta extends WP_Widget {

	function WP_Widget_Meta() {
		$widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") );
		$this->WP_Widget('meta', __('Meta'), $widget_ops);
	}

	function widget( $args, $instance ) {
		extract($args);
		$title = apply_filters('widget_title', empty($instance['title']) ? __('Meta') : $instance['title']);

		echo $before_widget;
		if ( $title )
			echo $before_title . $title . $after_title;
?>
			<ul>
			<?php wp_register(); ?>
			<li><?php wp_loginout(); ?></li>
			<?php wp_meta(); ?>
			</ul>
<?php
		echo $after_widget;
	}

[Pre 2.9] If you are trying to edit the meta data that appears in the sidebar of your WordPress blog, such as removing the RSS links, find this code in /includes/widget.php file and remove the unwanted lines.

This is what the original looks like:

/**
 * Display meta widget.
 *
 * Displays log in/out, RSS feed links, etc.
 *
 * @since 2.2.0
 *
 * @param array $args Widget arguments.
 */
function wp_widget_meta($args) {
	extract($args);
	$options = get_option('widget_meta');
	$title = empty($options['title']) ? __('Meta') : apply_filters('widget_title', $options['title']);
?>
		<?php echo $before_widget; ?>
			<?php echo $before_title . $title . $after_title; ?>
			<ul>
			<?php wp_register(); ?>
			<li><?php wp_loginout(); ?></li>
			<li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php echo attribute_escape(__('Syndicate this site using RSS 2.0')); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
			<li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php echo attribute_escape(__('The latest comments to all posts in RSS')); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
			<li><a href="http://wordpress.org/" title="<?php echo attribute_escape(__('Powered by WordPress, state-of-the-art semantic personal publishing platform.')); ?>">WordPress.org</a></li>
			<?php wp_meta(); ?>
			</ul>
		<?php echo $after_widget; ?>
<?php
}

And this is my modified one:

/**
 * Display meta widget.
 *
 * Displays log in/out, RSS feed links, etc.
 *
 * @since 2.2.0
 *
 * @param array $args Widget arguments.
 */
function wp_widget_meta($args) {
	extract($args);
	$options = get_option('widget_meta');
	$title = empty($options['title']) ? __('Meta') : apply_filters('widget_title', $options['title']);?>
		<?php echo $before_widget; ?>
			<?php echo $before_title . $title . $after_title; ?>
			<ul>
			<?php wp_register(); ?>
			<li><?php wp_loginout(); ?></li>
			<?php wp_meta(); ?>
			</ul>
		<?php echo $after_widget; ?>
<?php
}

32 comments

  1. Hi, thanks for the help, although, my widgets.php page looks a lot bigger than the one above and there is no code similar to the one you posted here in mine.

    maybe my WP version is different. I am rockin version 2.8.1

    Thanks

  2. Thanks so much for the advice, you were the only one that clearly defined where to find the file.

    After 40 minutes searching the web, I found how to remove wordpress.org from the meta section of my blog.

    Thanks!

  3. This looks like a really good article, but I do not have this code, I’m using 2.8.6, and my widget.php doesnt look like what you have above, any ideas, thanks.

  4. Just wanted to say thanks for the great explanation. It took me a couple of hours digging up into the wp files while trying to figure out how to customize the meta links…and then found your post, which explained things in straightforward manner, so I got the work done in less than 10 mins… thank you again for sharing this with the public
    all the best
    Ol

  5. thanks. this helps me how to remove some links on meta widget :)

    i have just resetted my site and know how to edit this in the past, but for some reason i totally forgot about what file to edit.

    thanx again

  6. Wow, Thank You so much! I’ve been all over the place looking for a solution for this problem and after I’d begun to resign myself to having that meta sidebar info on my blog, I found your site!
    It was right where you said it would be!
    Thank you for putting an end to my frustration 8)

  7. 2/17/2012

    This is addressed on many posts. Yours is the only one that understands that the code to be changed is in default-widgets.php, not widgets.php. This may not be universally true, but it is true for the 2011 theme.

    Thank you very much.

  8. Hi,

    Is there anyway of achieving this without editing the core WordPress files? I would rather this be a permanent change instead of having to reapply at every update.

    Thanks

    1. unfortunately no, you need to edit the core file, and continue to do so after each upgrade, providing you’re using the same theme. However you could create your oen theme and not have the widget call functions in your theme design, but that starts getting complicated.

  9. Another approach is just to enqueue a little script that depends on jQuery and hide the links you don’t want, like this:

    jQuery(document).ready(function() {
    if(jQuery(‘.widget_meta’).length > 0) {
    jQuery(‘.widget_meta a:contains(“Entries”), .widget_meta a:contains(“Comments”), .widget_meta a:contains(“WordPress”)’).closest(‘li’).hide();
    }
    });

  10. This plugin acts in exactly the same way as the standard Meta widget except that it adds options which allow you control which of the 5 standard Meta widget links should be displayed, with the additional option to add your own custom link.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>