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.
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)
Viewing 3 replies - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.