English 中文(简体)
WP Plugin: 使用了“添加”
原标题:WP Plugin: using add_filter inside of a class
  • 时间:2012-05-10 14:48:03
  •  标签:
  • wordpress

我正在使用WP诉3.3.1号文件,我正试图作一个假。 我把它推到了半工作阶段。 它启动了并增加了行动工作,但出于某种原因,我的过滤器没有启动。 当我走近时,我就认为我应该这样做,但我没有工作。 我也试图将它列入班外,那是没有工作的。 错误记录由施工人书写,但不是<代码>xmlAddMethod。 我在单一档案中测试了Xmlrpc的电话,它工作,但制造问题。

//DOESN T WORK HERE
add_filter(  xmlrpc_methods , array( &$this,  xmlAddMethod ) );

class TargetDomain extends Domain 
{
    public function __construct() 
    {        
        error_log( TARGET: __construct );
        //DOESN T WORK HERE EITHER
        add_filter(  xmlrpc_methods , array( &$this,  xmlAddMethod ) );
        parent::__construct();
    }

    function xmlAddMethod( $methods ) 
    {
        error_log( TARGET: xml_add_method );
        $methods[ myBlog.publishPost ] =  publishMyPost ;
        return $methods;
    }
最佳回答

修改:

add_filter(  xmlrpc_methods , array( &$this,  xmlAddMethod ) );

:

add_filter(  xmlrpc_methods , array(  TargetDomain ,  xmlAddMethod ) );
问题回答

您也可以使用网站_CLASS_

add_filter(  xmlrpc_methods , array( __CLASS__,  xmlAddMethod ) );




相关问题
Wrap stray text in <p> tags

Wordpress issue.. how do I wrap stray text in P tags? Example: Before- <div class = "content"> <img src = "hello.jpg"/> <h1>Introduction</h1> Hello! this is ...

Using jQuery Plugins with Wordpress

Having a bit of trouble using jQuery plugins (Superfish, jQuery UI, etc) using Wordpress. Everything works fine in my plain non-Wordpress site, but Wordpress seems to conflict with JQuery. There must ...

WordPress Data Storage Efficiency

I ve been asked to review a WordPress plugin of sorts and try to find ways of making it faster. The premise of this plugin is basically to store a bunch of users and shifts and appointments and ...

Why can t I properly style a blockquote in Wordpress?

On the design I just created for my website, I have a blockquote styled with two quote images using the span technique in css: blockquote { background-image: url(images/openquote.jpg); background-...

How does the WordPress <!--nextpage--> tag actually work?

What happens? I m guessing that somehow the post or page is parsed before displaying, and then just split into two methods? I can t seem to find any documentation on how the underlying <?php ...

Wordpress Plug-ins: How-to add custom URL Handles

I m trying to write a Wordpress Plug-in but can t seem to figure out how you would modify how a URL gets handled, so for example: any requests made for: <url>/?myplugin=<pageID> will ...

热门标签