WordPress:如何获取“the_content"过滤器的所有注册函数 [英] WordPress: How do I get all the registered functions for 'the_content' filter

查看:26
本文介绍了WordPress:如何获取“the_content"过滤器的所有注册函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于 WordPress 的问题,特别是 3.0 及更新版本.

有谁知道如何获取将应用于或注册"到 the_content 过滤器的所有函数的数组或列表?

这个想法是生成一个复选框列表,其中包含要从过滤器中删除的可能功能,例如 wpautop.我知道如何使用硬编码标签从过滤器中删除函数,但我希望创建一个更动态的解决方案.

如果有人对这是否可行以及如何完成有任何想法,我会非常感兴趣.谢谢.

解决方案

从过滤器数组打印的简单函数?

function print_filters_for( $hook = '' ) {全局 $wp_filter;if( 空( $hook ) || !isset( $wp_filter[$hook] ) )返回;打印 '

';打印_r($wp_filter[$hook]);打印 '</pre>';}

在需要的地方调用它.

print_filters_for('the_content');

I have a question regarding WordPress, specifically version 3.0 and newer.

Does anyone know how to get an array or list of all the functions that will be applied or are 'registered' to the_content filter?

The idea is to generate a checkbox list of possible functions to remove from the filter, such as wpautop. I know how to remove functions from the filter with hard coded labels, but I am hoping to create a more dynamic solution.

If anyone has any ideas if this is possible and how it could be done I would be very interested. Thanks.

解决方案

Simple function to print from the filter array?

function print_filters_for( $hook = '' ) {
    global $wp_filter;
    if( empty( $hook ) || !isset( $wp_filter[$hook] ) )
        return;

    print '<pre>';
    print_r( $wp_filter[$hook] );
    print '</pre>';
}

Call it where you need it.

print_filters_for( 'the_content' );

这篇关于WordPress:如何获取“the_content"过滤器的所有注册函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆