0
我有問題申請誰創造了他們後用戶post_type,理論上我發現的WordPress的那些功能,但顯然這是行不通的不工作is_author(get_current_user_id())函數WordPress的
function preview_publish_posts($query) {
if(is_user_logged_in() && is_author(get_current_user_id())) {
$query->set('post_status', array('publish', 'pending'));
}
return $query;
}
add_filter('pre_get_posts', 'preview_publish_posts');
還是有可能的功能不適用於從functions.php的
如果我沒有弄錯,is_author()沒有參數 - >當任何作者頁面正在顯示。帶參數的is_author()只會檢查是否顯示了作者檔案頁面,這是你想要做什麼? – Benoti
我有一個非常類似的問題給你。當我刪除get_current_user_id()時,它完全適用於所有作者頁面,但我只希望它能夠在當前登錄的作者頁面上工作。此外,我不認爲你需要使用「返回$查詢」這個工作。 – mikey242