if ( in_array( $plink, array( '404', 'sitemap' ) ) ) continue;
I need to invert condition i.e. allowed these values '404', 'sitemap' in loop. Don't exclude / only allow...
if ( in_array( $plink, array( '404', 'sitemap' ) ) ) continue;
I need to invert condition i.e. allowed these values '404', 'sitemap' in loop. Don't exclude / only allow...
For inverting/negation condition use !
.
if ( !in_array( $plink, array( '404', 'sitemap' ) ) ) continue;
It's the same principle like you probably know $a != $b
.
use NOT operator to get negation of the condition. See the code below.
if ( !in_array( $plink, array( '404', 'sitemap' ) ) ) {
echo "do what you want";
}