Make WordPress Core


Ignore:
Timestamp:
04/01/2026 02:56:47 PM (4 months ago)
Author:
jorgefilipecosta
Message:

Connectors: Replace plugin.slug with plugin.file in connector registration.

Use the plugin's main file path relative to the plugins directory
(e.g. akismet/akismet.php or hello.php) instead of the WordPress.org slug
to identify a connector's associated plugin.
This lets _wp_connectors_get_connector_script_module_data() check plugin
status with file_exists() and is_plugin_active() directly, removing the
get_plugins() slug-to-file mapping that was previously needed.

Props jorgefilipecosta, mukesh27, gziolo.
Fixes #65002.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-connector-registry.php

    r62180 r62192  
    4141 *     },
    4242 *     plugin?: array{
    43  *         slug: non-empty-string
     43 *         file: non-empty-string
    4444 *     }
    4545 * }
     
    110110         *         Optional. Plugin data for install/activate UI.
    111111         *
    112          *         @type string $slug The WordPress.org plugin slug.
     112         *         @type string $file The plugin's main file path relative to the plugins
     113         *                            directory (e.g. 'akismet/akismet.php' or 'hello.php').
    113114         *     }
    114115         * }
     
    243244                }
    244245
    245                 if ( ! empty( $args['plugin'] ) && is_array( $args['plugin'] ) ) {
    246                         $connector['plugin'] = $args['plugin'];
     246                if ( ! empty( $args['plugin'] ) && is_array( $args['plugin'] ) && ! empty( $args['plugin']['file'] ) ) {
     247                        $connector['plugin'] = array( 'file' => $args['plugin']['file'] );
    247248                }
    248249
Note: See TracChangeset for help on using the changeset viewer.