admin管理员组

文章数量:1122846

I would like to remove "Update now" below plugin name.

This is my Update info:

{
"slug" : "simple-wp-plugin-update",
"version" : "2.5",
"url": ";,
"package": "foo",
"tested" : "5.8",
"requires_php" : "5.3",
"name" : "Sample Plugin Name",
"author" : "<a href=''>Name</a>",
"requires" : "3.0",
"last_updated" : "2023-05-20 16:00:00",
"sections" : {
    "description" : "Description for the Description tab in the modal",
    "installation" : "Description for the Install tab in the modal",
    "changelog" : "<h4>2.0</h4><ul><li>Bug fix</li></ul>"
}
}

Php which gets update info:

add_filter('update_plugins_my-domain', 'check_update', 10, 4);
    
function check_update($update, $plugin_data, $plugin_file, $locales) {
    $remote = wp_remote_get(api_url);
    if(!is_wp_error( $remote )) {
        $remote = json_decode( wp_remote_retrieve_body( $remote ) );
    }
    return $remote;
}

This is showing me:

There is a new version of Sample Plugin Name available. View version 2.5 details or update now. 

If I add this:

add_action( 'in_plugin_update_message-simple-wp-plugin-update/simple-wp-plugin-update.php', 'display_update_message', 10, 2 );

function display_update_message( $plugin_info_array, $plugin_info_object ) {
    
    echo ' Some text here.';
    
}

It shows this text after the "Update now":

In following tutorial they remove "Update now" but leave "View version text..."

.html

How can I achieve this? They use "site_transient_update_plugins", but I use add_filter('update_plugins...

I tried this: but this completely removes everything (View version and Update now)

add_filter('site_transient_update_plugins', 'remove_update_notification');
function remove_update_notification($value) {
    unset($value->response[ plugin_basename(__FILE__) ]);
    return $value;
} 

本文标签: Wordpress plugin update View version remove Update now