How do I add options to "My Sites"

So you know on the "My Sites" page in multisite installations where it lists all your sites? I'm talking about the one found at "http://example.com/wp-admin/my-sites.php". I'd like to add some extra options for each website to make things easier.

Right now the options for each site is "Visit | Dashboard". I'd like to add more options like "DNS Settings" that links directly to my third party dns hosting for that site.

Just more so wondering what file I edit and where. An example of a new link to google.com for each site would be super great if at all possible in addition to whatever documentation you could provide.

Cheers and happy Tuesday!

  • Alexander

    Hi @_981,

    I'd recommend looking at the source for my-sites.php found in the wp-admin folder. You can add options to each site with a filter hook.

    Here's what you're looking for:

    /**
     * Filter the row links displayed for each site on the My Sites screen.
     *
     * @since MU
     *
     * @param string $string    The HTML site link markup.
     * @param object $user_blog An object containing the site data.
     */
    echo "<p>" . apply_filters( 'myblogs_blog_actions', "<a href='" . esc_url( get_home_url( $user_blog->userblog_id ) ). "'>" . __( 'Visit' ) . "</a> | <a href='" . esc_url( get_admin_url( $user_blog->userblog_id ) ) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>";
    /** This filter is documented in wp-admin/my-sites.php */
    echo apply_filters( 'myblogs_options', '', $user_blog );
    echo "</td>";
    $i++;

    If you'd like to add your own options, just add a filter like this:

    add_filter('myblogs_blog_actions','mysites_custom_actions');
    
    function mysites_custom_actions($user_blog) {
    
        echo '<a href="custom link">Custom Link</a>';
    
        //You can get blog specific info via $user_blog->userblog_id
    
    }

    You can place the code in functions.php of a theme (or Child Theme), in your own plugin, or using something like Code Snippets.

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.