Reverse array for a loop in functions

Question

I have some custom taxonomy that I would like to have two columns as per my theme (GeneratePress) but I would not this function to skip this command if they match particular slugs within the custom taxonomy.

Here’s my code:

add_filter( 'generate_blog_columns','cpt_archive_portfolio_columns' );
function cpt_archive_portfolio_columns( $columns ) {
    $cats = array('term-3','term-4','term-16','term-1','term-9');

    foreach($cats as $cid) {
        if ( is_tax( $cid ) ) {
            return false;
        }

        else
            return true;
    }

    return $columns;
}

I think my WordPress syntax is off?

The Custom Taxonomy is called “country” and I’d like to exclude countries that I believe I can do by mentioning their WordPress ID number as I have tried to do.

Can anyone point me in the right direction with this pls?

Thanks!

0
henry 3 years 2020-08-26T06:10:36-05:00 0 Answers 34 views 0

Leave an answer

Browse
Browse