WordPress的:如何获得'the_content'过滤器的所有注册功能 [英] WordPress: How do I get all the registered functions for 'the_content' filter

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

问题描述

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

有谁知道如何得到一个数组或列表中的所有将被应用或被注册到内容过滤器的函数?

这个想法是生成一个可以从过滤器中移除的可能功能的复选框列表,比如wpautop。我知道如何从硬编码标签的过滤器中删除函数,但我希望能够创建一个更动态的解决方案。

如果任何人有任何想法,如果这是可能的如何做到这一点我会非常感兴趣。感谢。

解决方案

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

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

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

$ / code>

在需要的地方调用它。

  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天全站免登陆