Having trouble with settings terms as array in pre_get_posts

You need to modify the tax_query block of code like below- $q->set( ‘tax_query’, array(array( ‘taxonomy’ => ‘product_cat’, ‘field’ => ‘term_id’, // Here it would be ‘term_id’ instead of only ‘ID’. ‘terms’ => $allowedCats, ‘operator’ => ‘IN’ // May be it would be ‘IN’ in stead of ‘NOT IN’. Cause you are passing allowed product categories. … Read more

Apply pre_get_posts to specific custom post type in the admin area

The function you are looking for is get_current_screen(). To check if you are on a specific custom post type page, do as follows: $screen = get_current_screen(); if ( $screen->post_type == ‘custom_job’ ) { // We are on custom_job post type, good to go } Now, if you visit edit.php?post_type=custom_job, this conditional will return true, which … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)