Title: Plugin installation link not working
Last modified: August 19, 2025

---

# Plugin installation link not working

 *  [nitrospectide](https://wordpress.org/support/users/nitrospectide/)
 * (@nitrospectide)
 * [9 months, 3 weeks ago](https://wordpress.org/support/topic/plugin-installation-link-not-working/)
 * I am still relatively new to creating plugins, and I’m trying to create an admin
   screen with a handy list of troubleshooting plugins I typically install, use,
   and remove. I have tried creating the link with a nonce, but every time I click
   the link, I’m told it’s expired.
 *     ```wp-block-code
       function custom_plugin_menu() {	// Add a submenu page under the "Plugins" menu	add_plugins_page(		'Plugin Library',	// Page title		'Plugin Library',	// Menu title		'manage_options',	// Capability required to access the page		'plugin-library',	// Menu slug (unique identifier for the page)		'plugin_library_page'	// Callback function to display the page content	);}add_action('admin_menu', 'custom_plugin_menu');function plugin_library_page() {	$bare_url = admin_url( 'update.php?action=install-plugin&plugin=which-template-file' ); // The base URL for your action	$nonce_action = 'plugin_install_nonce'; // A unique string identifying the nonce's purpose	$nonce_url = wp_nonce_url( $bare_url, $nonce_action );			// Output HTML content for your custom admin page here	echo '<div class="wrap">';	echo '<h1>Library of Commonly Used Temporary Plugins</h1>';	echo '<a href="'.  $nonce_url  .'">Which Template</a>';	echo '</div>';}
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [9 months, 3 weeks ago](https://wordpress.org/support/topic/plugin-installation-link-not-working/#post-18605800)
 * If I understand correctly, you want to use this link to install the `which-template-
   file` plugin. To do this, call up the` update.php` file from the WordPress Core.
   There you will find this section that checks the nonce value in this case: [https://github.com/WordPress/WordPress/blob/master/wp-admin/update.php#L112](https://github.com/WordPress/WordPress/blob/master/wp-admin/update.php#L112)
 * This means that you have to construct your nonce value differently. Like this:
 *     ```wp-block-code
       $nonce_action = 'install-plugin_which-template-file';
       ```
   
 * Then the link will work 🙂
 * Why? Because you should generally only set the nonce value that is actually queried,
   and not just any value. If you want to use WordPress’s own functions, take a 
   look at their source code and see if and which nonce values they use there.
 *  Thread Starter [nitrospectide](https://wordpress.org/support/users/nitrospectide/)
 * (@nitrospectide)
 * [9 months, 3 weeks ago](https://wordpress.org/support/topic/plugin-installation-link-not-working/#post-18605848)
 * First, thank you. That fixed it.
 * Second, as mentioned, I am very new at this, and don’t understand why it fixed
   it. I see the ‘install-plugin_’ prefix listed in line 112, and that it’s being
   handed as a parameter to check_admin_referer(), but don’t understand what that’s
   doing. I see it come up elsewhere in that file, and it looks like it’s doing 
   a check to see which action should be performed. It seems that my problem arose
   from example code that didn’t call this out, and made it seem like this was just
   a generic identifier string that only needed to be unique (presumably to act 
   as an id somewhere).
   `$nonce_action = 'plugin_install_nonce'; // A unique string
   identifying the nonce's purpose`
 * How does one look up functions to investigate these things?
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [9 months, 3 weeks ago](https://wordpress.org/support/topic/plugin-installation-link-not-working/#post-18606228)
 * Take a look at the manual for nonces: [https://developer.wordpress.org/apis/security/nonces/](https://developer.wordpress.org/apis/security/nonces/)
 * Or this article: [https://developer.wordpress.org/news/2023/08/understand-and-use-wordpress-nonces-properly/](https://developer.wordpress.org/news/2023/08/understand-and-use-wordpress-nonces-properly/)
 * check_admin_referer is described here: [https://developer.wordpress.org/reference/functions/check_admin_referer/](https://developer.wordpress.org/reference/functions/check_admin_referer/)–
   the above pages will show you when this function is used.
 * Tip: Before you use any system functions such as install, create a page in the
   backend where you send a link to your own programming. In the simplest case, 
   this can be an admin_action, see: [https://developer.wordpress.org/reference/hooks/admin_action_action/](https://developer.wordpress.org/reference/hooks/admin_action_action/)
 * Example:
 *     ```wp-block-code
       // define the action url in any function which displays in backend.$url = add_query_arg(	array(		'action' => 'your_custom_action',		'nonce'  => wp_create_nonce( 'your-custom-nonce' ),	),	get_admin_url() . 'admin.php');?><a href="<?php echo esc_url( $url); ?>">click me</a><?php// use hook to use this admin action.add_action( 'admin_action_your_custom_action', function() { check_admin_action( 'your-custom-nonce', 'nonce' ); echo "ok";exit;});
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Plugin installation link not working’ is closed to new replies.

## Tags

 * [cache](https://wordpress.org/support/topic-tag/cache/)
 * [plugin](https://wordpress.org/support/topic-tag/plugin/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 2 participants
 * Last reply from: [threadi](https://wordpress.org/support/users/threadi/)
 * Last activity: [9 months, 3 weeks ago](https://wordpress.org/support/topic/plugin-installation-link-not-working/#post-18606228)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
