Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //With print_r and with exclude category
- // auto posts by cat
- if( $bawmrp_options['auto_posts'] == 'cat' || $bawmrp_options['auto_posts'] == 'both' ):
- $cat = get_the_category( $post->ID );
- $cat_ids = wp_list_pluck( $cat, 'term_id' );
- $key = array_search('68', $cat_ids);
- unset($cat_ids[$key]);
- $args['category'] = implode( ',', $cat_ids );
- print_r($args);
- endif;
- Output: Array ( [post_type] => wpcproduct [post_status] => publish [post__not_in] => Array ( [0] => 3216 ) [numberposts] => 10 [post_count] => 10 [order] => RAND [category] => )
- //With print_r and without exclude category (Original code)
- // auto posts by cat
- if( $bawmrp_options['auto_posts'] == 'cat' || $bawmrp_options['auto_posts'] == 'both' ):
- $cat = get_the_category( $post->ID );
- $cat_ids = wp_list_pluck( $cat, 'term_id' );
- $args['category'] = implode( ',', $cat_ids );
- print_r($args);
- endif;
- Output: Array ( [post_type] => wpcproduct [post_status] => publish [post__not_in] => Array ( [0] => 3216 ) [numberposts] => 10 [post_count] => 10 [order] => RAND [category] => )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement