This filter has to be set in functions.php
.
Your filter won’t work as expected because your condition is wrong.
The condition here imply that you try to order pages (hierarchical post) instead of regular posts-like entries.
You have to be careful using this filter as it has effect on your whole website.
function my_custom_archive_order( $vars ) {
if ( !is_admin() && isset($vars['post_type']) && $vars['post_type'] == 'pc' ) {
$vars['orderby'] = 'menu_order';
$vars['order'] = 'DESC'; // you probably don't need this because that's the default behaviour
}
return $vars;
}
add_filter( 'request', 'my_custom_archive_order');
https://codex.wordpress.org/Plugin_API/Filter_Reference/request