You can achieve it with pre_get_posts
. With your current code there are multiple syntax errors. You have write it this way
add_filter('pre_get_posts', 'limit_change_posts_archive');
function limit_change_posts_archive($query){
if ( !is_admin() && $query->is_main_query() && is_archive() && is_tax( 'pdsh_categories' ) && is_term( 1858 )) {
$query->set('posts_per_page', -1);
}
return $query;
}
As is_term
is deprecated a different approach can be like this:
add_filter('pre_get_posts', 'limit_change_posts_archive');
function limit_change_posts_archive($query){
if ( !is_admin() && $query->is_main_query() && is_archive() && is_tax( 'pdsh_categories', 1858 )) {
$query->set('posts_per_page', -1);
}
return $query;
}
Again this above code needs to be tested.