钩子文档

wp_plugin_dependencies_slug

💡 云策文档标注

概述

wp_plugin_dependencies_slug 是一个 WordPress 过滤器,用于在匹配 WordPress.org slug 格式之前修改插件依赖项的 slug。例如,可用于在免费和高级插件 slug 之间切换。

关键要点

  • 这是一个过滤器,钩子名为 wp_plugin_dependencies_slug。
  • 主要用途是调整插件依赖项的 slug,以适配 WordPress.org 的 slug 格式。
  • 参数为 $slug(字符串类型),表示要过滤的 slug。
  • 在 WP_Plugin_Dependencies::sanitize_dependency_slugs() 方法中使用,用于清理 slug。
  • 自 WordPress 6.5.0 版本引入。

📄 原文内容

Filters a plugin dependency’s slug before matching to the WordPress.org slug format.

Description

Can be used to switch between free and premium plugin slugs, for example.

Parameters

$slugstring
The slug.

Source

$slug = apply_filters( 'wp_plugin_dependencies_slug', $slug );

Changelog

Version Description
6.5.0 Introduced.