钩子文档

dashboard_secondary_feed

💡 云策文档标注

概述

此文档介绍 dashboard_secondary_feed 过滤器,用于修改 WordPress 仪表板中“WordPress 事件和新闻”小部件的次要源 URL。该过滤器允许开发者自定义次要源地址,以调整小部件显示的内容。

关键要点

  • dashboard_secondary_feed 是一个过滤器,用于过滤次要源 URL。
  • 参数 $url 接受字符串类型,表示小部件的次要源 URL。
  • 默认次要源 URL 为 https://planet.wordpress.org/feed/,可通过过滤器覆盖。
  • 此过滤器在 wp_dashboard_primary() 函数中使用,位于 wp-admin/includes/dashboard.php 文件中。
  • 自 WordPress 2.3.0 版本引入。

代码示例

'url' => apply_filters(
    'dashboard_secondary_feed',
    /* translators: Link to the Planet feed of the locale. */
    __( 'https://planet.wordpress.org/feed/' )
),

📄 原文内容

Filters the secondary feed URL for the ‘WordPress Events and News’ dashboard widget.

Parameters

$urlstring
The widget’s secondary feed URL.

Source

'url'          => apply_filters(
	'dashboard_secondary_feed',
	/* translators: Link to the Planet feed of the locale. */
	__( 'https://planet.wordpress.org/feed/' )
),

Changelog

Version Description
2.3.0 Introduced.