Filter hook 'wp_plugin_dependencies_slug'

in WP Core File wp-includes/class-wp-plugin-dependencies.php at line 603

View Source

wp_plugin_dependencies_slug

Filter Hook
Description
Filters a plugin dependency's slug before matching to the WordPress.org slug format. Can be used to switch between free and premium plugin slugs, for example.

Hook Information

File Location wp-includes/class-wp-plugin-dependencies.php View on GitHub
Hook Type Filter
Line Number 603

Hook Parameters

Type Name Description
string $slug The slug.

Usage Examples

Basic Usage
<?php
// Hook into wp_plugin_dependencies_slug
add_filter('wp_plugin_dependencies_slug', 'my_custom_filter', 10, 1);

function my_custom_filter($slug) {
    // Your custom filtering logic here
    return $slug;
}

Source Code Context

wp-includes/class-wp-plugin-dependencies.php:603 - How this hook is used in WordPress core
<?php
 598  			 *
 599  			 * @since 6.5.0
 600  			 *
 601  			 * @param string $slug The slug.
 602  			 */
 603  			$slug = apply_filters( 'wp_plugin_dependencies_slug', $slug );
 604  
 605  			// Match to WordPress.org slug format.
 606  			if ( preg_match( '/^[a-z0-9]+(-[a-z0-9]+)*$/mu', $slug ) ) {
 607  				$sanitized_slugs[] = $slug;
 608  			}

PHP Documentation

<?php
/**
			 * Filters a plugin dependency's slug before matching to
			 * the WordPress.org slug format.
			 *
			 * Can be used to switch between free and premium plugin slugs, for example.
			 *
			 * @since 6.5.0
			 *
			 * @param string $slug The slug.
			 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/class-wp-plugin-dependencies.php
Related Hooks

Related hooks will be displayed here in future updates.