WordPress.org

Ready to get started?Download WordPress

Forums

How can I remove the Meta widget's Register link on network sites? (5 posts)

  1. sunrise3
    Member
    Posted 4 years ago #

    Hola,

    I am about to enable user and site registrations . . .

    when registration is enabled the network sites also show a "Register" option on the Meta widget but I only want them to show a Login option there . . . since I find it confusing that the register link on a network site goes to the sign up page of the main site . . .

    Also themes have a default meta widget showing all kinds of links so I would want to make sure neither that default meta widget nor a once sidebar is customized appearing meta widget shows a register link . . .

    . . . thanks in advance for any help there . . .

  2. David Sader
    Member
    Posted 4 years ago #

    First, get rid of the Meta widget altogether. You can, with an mu-plugin unregister any or all the widgets built into WordPress core with a function such as the following:

    function ds_unregister_widgets() {
    	$widgets = array(
    				'WP_Widget_Meta',
    //				'WP_Widget_Recent_Comments',
    //				'WP_Widget_RSS',
    //				'WP_Widget_Text',
    //				'WP_Widget_Pages',
    //				'WP_Widget_Calendar',
    //				'WP_Widget_Archives',
    //				'WP_Widget_Links',
    //				'WP_Widget_Categories',
    //				'WP_Widget_Recent_Posts',
    //				'WP_Widget_Search',
    //				'WP_Widget_Tag_Cloud',
    				);
    		foreach($widgets as $widget) {
    			unregister_widget($widget);
    		}
    }
    add_action('widgets_init', 'ds_unregister_widgets');
    ?>

    Second, widgets/links added by themes will need <?php wp_register(); ?> to be plucked manually from their functions.php or sidebar.php.

    Third, create your own customized meta widget and plug it in. Start from here: http://wordpress.org/extend/plugins/customize-meta-widget/

  3. David Sader
    Member
    Posted 4 years ago #

    I just changed the wp_register link from "Site Admin" to "Dashboard" with the following "mu-plugin":

    <?php
    function ds_filter_register_link() {
    		$link = '<li><a href="' . admin_url() . '">' . __('Dashboard') .  '</a></li>';
    		return $link;
    }
    add_filter( 'register', 'ds_filter_register_link' );
    ?>
  4. sunrise3
    Member
    Posted 4 years ago #

    sounds like solid advice thanks should I drop my wordpress newcomer doubts about installing plugins in general (so far I am using none) I am looking forward to following your pointers so again thanks . . .

    although I guess at this time I will first take a look at what I might find and can possibly hack in the individual network themes which probably is at least half of a solution if I get it right and no big harm if not :)

  5. David Sader
    Member
    Posted 4 years ago #

    Changing code in themes can be a pain, even one line. Especially, if the theme updates.

    Using Child themes would be the best way to go, in practice.

    1. Create a child theme of the theme you want to modify.
    2. Disable the parent theme but enable the Child under SuperAdmin->Themes.
    3. Activate the Child theme on your blog as usual under Appearance->Themes.

    That way when a theme gives a notice to update under Dashboard->Updates your changes to the Child theme remain untouched.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.