plugin-update-checker icon indicating copy to clipboard operation
plugin-update-checker copied to clipboard

Is it possible to disable the "update now" link completely?

Open borademircan opened this issue 4 years ago • 3 comments

We have a plugin sold in a marketplace and we only want to display a message that the plugin needs an update rather than an "update now" link. Is this possible?

Or, are we able to customize the message?

Thanks!

borademircan avatar Mar 05 '21 22:03 borademircan

The simplest way to do that would be to remove the download_url field from the update information. If there is no download URL, WordPress will still show a notification that an update is available, but it won't include the "update now" link. Instead, it will say something like "Automatic update is unavailable for this plugin". The user won't be able to install the update using the admin dashboard.

This update checker doesn't provide a way to customize the update notification; those notifications are part of WordPress core. It doesn't look like WordPress has a convenient hook you could use, either. If you want to change the notification message, you might have to either use the gettext filter to modify the text, or hide the notification entirely and replace it with your own.

YahnisElsts avatar Mar 06 '21 10:03 YahnisElsts

Thank you Yahnis,

Meanwhile, I found a way to append a text to the original update text. Here's how to do it if anyone is interested:

add_action( 'in_plugin_update_message-' . 'your_path/to_main_file.php', 'addUpgradeMessageLink');

function addUpgradeMessageLink () {
	echo sprintf( ' ' . esc_html__( 'Your text with %slink%s here.', 'your_domain' ), '<a href="your_url_here">', '</a>' );
}

borademircan avatar Mar 06 '21 18:03 borademircan

Ah, good find. I had forgotten about that hook.

YahnisElsts avatar Mar 07 '21 10:03 YahnisElsts