1

ショートコードでアクティブ化される私の開発した wordpress プラグインは、ヘッダーを変更できないと言って管理領域を壊しています。もう少し深く掘り下げると、関数がエコーされている場合、この問題が発生している場合は問題ないことがわかりましたreturn。しかし、戻り値の問題は、html を取得するために ajax を使用し、この場合、出力が生成されないことです。

message Cannot modify header information - headers already sent by (output started at /var/www....    web/wordpress/wp-admin/admin-header.php


MyClass{

public function __construct()
         public $data;

    { 
                require_once(dirname(__FILE__) . '/class/class.another.php');
                $this->data = new Another(); 
        add_action( 'init', array( &$this, 'init' ) );      
    }



public function init()
    {
        add_shortcode( 'my_shortcode', array ($this, 'shortcode') );
                if(isset($_POST['id'])){

            $param = $this->data->output_ajax_html($_POST['id']);

            echo $this->shortcode_html_extended($param);
                        //this part breaks the buffer without echo is working   but the contertn won't show up      

        }       

    }

public function shortcode()
    {
        add_shortcode( 'my_shortcode', array ($this, 'shortcode_html') );   
    }

public function shortcode_html()
    {
        $html = "";
            $html .="";
            return $html;

    }

public function shortcode_html_extended($param)
    {
        $html = "";
            //mixed with php
            $html .="";
            return $html;
    }
} 

$test = new MyClass();
4

0 に答える 0