• TheRealCJ96

    (@therealcj96)


    Hi all, I would like to rename the link “Site Admin” to “Dashboard” that appears in the meta widget on my site when logged in. I have the plugin called “Meta Widget Customizer”, and it is in that the link appears. I don’t want to edit the actual URL it leads to, but rather just the link as it appears in the meta box.

    Any ideas as to how I should do this?

    Also, it would be nice if I did not have to do this after every WordPress update.

    All help is appreciated,
    TheRealCJ96

Viewing 4 replies - 1 through 4 (of 4 total)
  • wpismypuppet

    (@wordpressismypuppet)

    Because it’s a plugin that’s causing the issue, you would need to contact the plugin author and see if there is a hook to call for when the “names” of the links are being printed to the screen. Or, you can look through the code and look for the hook yourself. I doubt it was coded in such a way, so you’re probably looking at a JS solution, since you don’t want to hack the plugin in case of future updates.

    Thread Starter TheRealCJ96

    (@therealcj96)

    Isn’t there something I can write in the functions.php file? It is a plugin yes, but I think it borrows the link from the Meta Widget that comes with WordPress, as it also shows up there.

    wpismypuppet

    (@wordpressismypuppet)

    Of course there is something you can write in the functions.php file. That’s what I meant by “look for the hook”. However, since the build in widget is practically in-editable, you’ll basically be re-writing the plugin. See here:

    https://www.ads-software.com/support/topic/edit-meta-widget-in-theme-file?replies=12

    Here’s another way to customize the default meta widget code. Perhaps if you do it this way, you won’t need the added Meta Widget Customizer plugin at all ??

    https://guillaumepaumier.com/2012/01/26/customizing-the-wordpress-meta-widget/#Code

    Hi guys,

    In Widget area there is Meta widget. And it displays links like ‘Site Admin’, ‘Register’, ‘Log in’ etc. I just want to change label of these links.(Ex. I want to replace/rename ‘Site Admin’ label to ‘My Profile’.) I have spent my lot of time for searching this. I wondered that I was not able to find any WordPress plugin to do that, no posts links etc. immediately.

    But finally, after long time search I found some solution on following link:-
    Changing Meta widget Register to Signup

    I hope, it might be helpful to others.

    In my case, I want to display label according to user role. If user is ‘Subscriber’ then he should see link with label ‘My Profile’ and if user is with roles like ‘Administrator’, ‘Editor’ etc, then he should see link with label ‘Site Admin’.
    So I did some changes in code and put it in functions.php of my theme as:

    function change_register($link) {
        global $current_user;
        $user = $current_user;
    
        if ( isset( $user->roles ) && is_array( $user->roles ) ) {
            //check for Subscriber
            if ( in_array( 'subscriber', $user->roles ) ) {
                $link = str_replace("Site Admin", "My Profile", $link);
            }
        }
        return $link;
    }
    add_filter('register', 'change_register');

    Thanks & Regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Edit "Site Admin" text in meta widget’ is closed to new replies.