Hi,
Sorry for not giving more details.
The args should be:
$query = new WP_Query( array( ‘cat’ => 4 ) );
but they are in your code:
$query = new WP_Query(array(‘cat’ => array( ‘cat’ => 4 ) ));
this is the exact copy from your code:
$args = array(
‘cat’ => array( ‘cat’ => $category),
‘category__not_in’ => $exclude_categories,
‘post__not_in’ => array( $exclude_current_post ),
‘showposts’ => isset($instance[‘num’])?$instance[‘num’]:0, // Number of same posts that will be shown
‘ignore_sticky_posts’ => 1,
‘orderby’ => $sort_by,
‘order’ => $sort_order
);
The problem was that the posts were not pulled from the same category, the category was ignored. I corrected that line and now the posts are pulled from the correct category. It is a small problem probably from your latest update and I just wanted to warn you about it.
I have a custom theme, wordpress 4.2.2
Thank you for your response.