Last active
October 5, 2022 11:47
-
-
Save rayhanuddin2019/c1053b96b5d1b67bfda9963eb9cb43f0 to your computer and use it in GitHub Desktop.
manual plugin install
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
$url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=automatic-youtube-gallery' ), 'install-plugin_automatic-youtube-gallery' ); | |
Below you’ll find a function that generates a plugin install link for WordPress. You can use this in the dashboard. This link acts the same way as the “Install plugin” buttons when searching for plugins within WordPress. | |
$url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin={plugin_slug}' ), 'install-plugin_{plugin_slug}' ); | |
----------------- Second solution ------------------- | |
$action = 'install-plugin'; | |
$slug = 'akismet'; | |
$url = wp_nonce_url( | |
add_query_arg( | |
array( | |
'action' => $action, | |
'plugin' => $slug | |
), | |
admin_url( 'update.php' ) | |
), | |
$action.'_'.$slug | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment