5

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

5
  • Is your plugin in the WordPress repository, or is it private? 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 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? Commented Aug 27, 2015 at 14:28
  • @TheDeadMedic because project manager requires it to be exactly that name 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) Commented Aug 27, 2015 at 14:42

3 Answers 3

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");
4
  • Pretty original, but still works only when plugin is active, thanks for sharing your idea though! Commented Aug 28, 2015 at 6:25
  • You could put this code in your functions.php file instead. That way it runs even if the plugin is not active. Change the path to the JS file to a directory in your theme. Commented Aug 28, 2015 at 14:45
  • Yes but it has to run on different machines and modifying functions.php on every machine is not the solution Commented Aug 29, 2015 at 8:28
  • If one or more plugins use wp_enqueue_script( 'my_custom_script', the last plugin to fire my_custom_script will overwrite all others, it should be unique to the plugin and the specific script your loading Commented Jan 16, 2021 at 22:00
0

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.

2
  • Thanks for help, if there's no way of making changes without activating the plugin i'm going to have to find another way Commented Aug 28, 2015 at 6:28
  • Right, only via including source, like via plugin or theme. The easiest way is a other name, with crazy prefix ;)
    – bueltge
    Commented Aug 28, 2015 at 8:11
0

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".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.