php - Making plugin unique to not conflict with plugins with the same name

admin2025-01-07  4

I have plugin that has the same name as other plugin uploaded to wordpress
How can i make it unique so it doesn't share "View Detais" link and auto-update with other plugin uploaded to wordpress? Considering that name of my plugin has to be exactly name it already has and cannot be changed.
I've already tried adding this code to myplugin.php:

add_filter( 'site_transient_update_plugins', 'filter_plugin_updates' );
function filter_plugin_updates( $value ) {
if (!empty($value)) {
    unset( $value->response['myplugin/myplugin.php'] );
    return $value;
   }
}

And that removes update notification for this plugin but only when it's active, and i need to remove it completely with "View Detais" link.
Also my plugin is private and will not ever be in the wordpress repository and will not ever need auto-updation.
Any suggestions? Thanks

I have plugin that has the same name as other plugin uploaded to wordpress.org
How can i make it unique so it doesn't share "View Detais" link and auto-update with other plugin uploaded to wordpress.org? Considering that name of my plugin has to be exactly name it already has and cannot be changed.
I've already tried adding this code to myplugin.php:

add_filter( 'site_transient_update_plugins', 'filter_plugin_updates' );
function filter_plugin_updates( $value ) {
if (!empty($value)) {
    unset( $value->response['myplugin/myplugin.php'] );
    return $value;
   }
}

And that removes update notification for this plugin but only when it's active, and i need to remove it completely with "View Detais" link.
Also my plugin is private and will not ever be in the wordpress repository and will not ever need auto-updation.
Any suggestions? Thanks

Share Improve this question edited Aug 27, 2015 at 14:10 Danil Solodunov asked Aug 27, 2015 at 13:39 Danil SolodunovDanil Solodunov 1131 silver badge6 bronze badges 5
  • Is your plugin in the WordPress repository, or is it private? – TheDeadMedic Commented Aug 27, 2015 at 14:06
  • @TheDeadMedic my plugin is private and is not planning to ever be in the wp repository as well as not planning to ever be updated automatically – Danil Solodunov Commented Aug 27, 2015 at 14:08
  • Just checking. And I'm sorry to be so curious, but since it's private, why can't you change the name of your plugin? – TheDeadMedic Commented Aug 27, 2015 at 14:28
  • @TheDeadMedic because project manager requires it to be exactly that name – Danil Solodunov Commented Aug 27, 2015 at 14:32
  • 1 All I can suggest is to change the plugin path (folder/main-plugin-file) to something very unique - the plugin name can stay the same (WP uses the path as part of it's update algorithm). Failing that, use an extremely high plugin version (perhaps date format, like 20150827) – TheDeadMedic Commented Aug 27, 2015 at 14:42
Add a comment  | 

3 Answers 3

Reset to default 0

Do you need the "View Details" link? It shouldn't show up unless it's a WP hosted plugin. Could you just name the plugin whatever you want, but change it with JS in the admin

function my_enqueue($hook) {
if ( 'plugins.php' != $hook ) {
    return;
}

wp_enqueue_script( 'my_custom_script', plugin_dir_url( __FILE__ ) . 'changeName.js', array( 'jquery' ), '1', true );
}
add_action( 'admin_enqueue_scripts', 'my_enqueue' );

Your changeName.js could look like this:

jQuery("#pluginId").html("Plugin Name the PM Likes");

If your plugin is not in the official wp plugin repository, than add a small function in your plugin, that exclude it from the update routine. It is not helpful that WordPress search for a update or this plugin.

The source below helps you. Include it in your plugin to deactivate the update check for your custom plugin, in topic performance and redundancy with other plugins.

add_filter( 'site_transient_update_plugins', 'fb_remove_update_notifications' );
// Remove update notice for forked plugins.
function fb_remove_update_notifications($value) {

    if ( isset( $value ) && is_object( $value ) ) {
        unset( $value->response[ plugin_basename( __FILE__ ) ] );
    }

    return $value;
}

But you have right, it works only, if the source is active. For inactive plugins can you not help via source. The only way is a string for the plugin name and file name, there is with a prefix, there very seldom, now and in the feature. If you can't include source, then it is not possible to change the core functionality.

Plugin Name and plugin "wp-content/plugins/directory-name" are not the same nor required to be same. Don't change Plugin Name, just change your plugin "directory-name" to anything else. Or, in example, replace "directory-name" with "directory_name" or with "directoryname". WP is checking for updates by plugin "slug", which is actually Plugin "directory-name".

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736263038a860.html

最新回复(0)