函数文档

wp_check_term_meta_support_prefilter()

💡 云策文档标注

概述

wp_check_term_meta_support_prefilter() 是一个 WordPress 过滤器函数,用于在 term meta 不被支持时中止相关函数调用。它检查数据库版本以确定 term meta 功能是否可用。

关键要点

  • 函数作用:作为 prefilter,在 term meta 不被支持时返回 false 以阻止执行。
  • 参数:$check(mixed 类型,必需),用于决定是否继续 term meta 函数执行。
  • 返回值:返回 $check 的原始值,或如果 term meta 不被支持则返回 false。
  • 相关函数:与 get_option() 和 has_term_meta() 关联,用于检查数据库版本和获取 term meta 数据。
  • 版本历史:自 WordPress 5.0.0 版本引入。

📄 原文内容

Aborts calls to term meta if it is not supported.

Parameters

$checkmixedrequired
Skip-value for whether to proceed term meta function execution.

Return

mixed Original value of $check, or false if term meta is not supported.

Source

function wp_check_term_meta_support_prefilter( $check ) {
	if ( get_option( 'db_version' ) < 34370 ) {
		return false;
	}

	return $check;
}

Changelog

Version Description
5.0.0 Introduced.