Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Limit tags to a pre-defined list?

Whoops, I need to use more test data next time.

Change:

foreach ($current_tags as $tag_key => $tag ) {
if( in_array( $tag->name, $allowed_tags ) )
unset( $allowed_tags[ $tag_key ] );
}

to

$allowed_tags = array_flip( $allowed_tags ); // CHANGE PLACES!
foreach( $current_tags as $tag ) {
if( isset( $allowed_tags[ $tag->name ] ) )
unset( $allowed_tags[ $tag->name ] );
}
$allowed_tags = array_flip( $allowed_tags ); // CHANGE PLACES!

The closing ?> isn’t really important if there’s no non-PHP data after it

Skip to toolbar