忍者ブログ
04 May

[PR]

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

28 January

タクソノミーアーカイブページで管理画面の順番通りにする


https://web.studio-nanntoca.com/wordpress/847
ありがたいコードを引用
 functions.phpにかく
function cat_products_sort_order($query)
{
    if (is_admin() || !$query->is_main_query()) {
        return;
    }
    if ($query->is_tax('cat_products')) {
        $query->set('orderby', 'menu_order');
        $query->set('order', 'ASC');
    }
}
add_action('pre_get_posts', 'cat_products_sort_order');
PR