2011-09-06 11 views

回答

0

試着讓你的render_grid方法公開。據我所知,這是需要做到這一點的過濾器功能。

0

有沒有必要使用參考&$thischeck the manual

調用過濾器這種方式爲我的作品:

add_filter('content_save_pre', array($this, 'render_grid')); 

我也很好奇,你爲什麼不通過$content參數的過濾功能?

public function save($post_id) { 
    ... 
    add_filter('content_save_pre', array($this, 'render_grid'), 10, 1); 
} 
function render_grid($content) { 
    ... 
    return $grid_content; 
} 

和另一note from the codex

過濾它完成 處理或內容將是空

希望這個答案可以幫助後功能必須返回一個字符串。