How to edit the Meta widget in WordPress
Whether a site needs user registration is a question that sparks a lot of debate.
On one hand, it improves the so-called user engagement factor — visitors spend more time on the site, you can hook readers with hidden content visible only to registered users, and so on.
On the other hand, requiring registration to read content, in a huge number of cases, simply scares off potential readers and makes them leave the site right away.
Let’s leave that question up to the webmaster.
What I needed was to add a login/registration panel to a site running WordPress. There’s a dedicated Meta widget for that. It’s part of the standard widget set, so no need to hunt it down, download or activate it — just drag it into place.
But!
The default widget contains not just registration/login links, but also a link to the WordPress site, RSS links for comments, RSS for posts, and a few other things.
Need to strip out the extra links, meaning edit the Meta widget’s code.
Open the default-widgets.php file,
located in the wp-includes folder.
Find this snippet:
<ul>
<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>
<li><a href="<?php bloginfo('rss2_url'); ?>" ........</li>
<li><a href="<?php bloginfo('comments_rss2_url'); ?>" .......</li>
<li><a href="<?php esc_attr_e( 'http://wordpress.org/' ); ?>"..........</li>
<?php wp_meta(); ?>
</ul>
These are the main links that need editing.
You can safely delete all three links, i.e. the following lines:
<li><a href="<?php bloginfo('rss2_url'); ?>" ........</li>
<li><a href="<?php bloginfo('comments_rss2_url'); ?>" .......</li>
<li><a href="<?php esc_attr_e( 'http://wordpress.org/' ); ?>"..........</li>