Last active
January 16, 2018 16:23
-
-
Save soderlind/adce00cc8bb9fac9888982394fd5f114 to your computer and use it in GitHub Desktop.
Mercator: Add Manage Aliases link to Sites in sites.php. Save fil in wp-content/mu-plugins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Mercator: Add Manage Aliases link to Sites in sites.php | |
* Version: 0.1.0 | |
* Plugin URI: https://gist.github.com/soderlind/adce00cc8bb9fac9888982394fd5f114 | |
* Author: Per Soderind | |
* Author URI: https://soderlind.no | |
* Requires PHP: 7.0.0 | |
*/ | |
namespace Soderlind\MuPlugins; | |
add_filter( 'manage_sites_action_links', __NAMESPACE__ . '\\manage_domains_for_site', 10, 2 ); | |
function manage_domains_for_site( $actions, $blog_id ) { | |
if ( is_main_site( $blog_id ) ) { | |
return $actions; | |
} | |
if ( ! is_mercator_enabled() ) { | |
return $actions; | |
} | |
$mercator_alias_url = add_query_arg( 'id', $blog_id, network_admin_url( 'admin.php?action=mercator-aliases' ) ); | |
$actions = array_merge( | |
$actions, [ | |
'mercator_alias_url' => sprintf( '<a href="%s">%s</a>', $mercator_alias_url, __( 'Manage Aliases' ) ), | |
] | |
); | |
return $actions; | |
} | |
function is_mercator_enabled() { | |
return has_action( 'mercator_load' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment