2016-07-05 9 views

答えて

0
add_action('pre_get_posts', 'custom_pre_get_posts'); 

function custom_pre_get_posts($q) { 

     if (! $q->is_main_query()) return; 

     if (! $q->is_post_type_archive()) return; 

     if (! (current_user_can('edit_product')) && is_shop()) { 
        $q->query_vars['author'] = get_current_user_id(); 

     } 

remove_action('pre_get_posts', 'custom_pre_get_posts_query'); 

} 

はこのスニペット

+0

を試してみてください...彼らは唯一のこれらの製品を変更することができますが、私は違うshopmanager異なる製品を隠したいために私はポスト非表示に多分この作品、製品は隠す必要があります。 – Andreis

+0

uはquery_varsに 'post_type'を適用できます。私の答えは更新されます –

関連する問題