Last active
October 7, 2018 23:32
-
-
Save wpscholar/1227688 to your computer and use it in GitHub Desktop.
Add a settings link to your WordPress plugin
This file contains hidden or 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 | |
/** | |
* Add a settings link to your WordPress plugin on the plugin listing page. | |
*/ | |
function add_settings_link( $links, $file ){ | |
if( $file == plugin_basename(__FILE__) ){ | |
$settings_link = '<a href="'.admin_url('admin.php?page=my-page').'">'.__('Settings', $this->textdomain).'</a>'; | |
array_unshift( $links, $settings_link ); | |
} | |
return $links; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How would one call this?
add_filter( "plugin_action_links", plugin_basename(__FILE__), 'add_settings_link' );