Remove dashicons.min.css conditionally

Trying to remove dashicons for non-logged in users excluding specific pages and specific categories with the following:

add_action( ‘wp_enqueue_scripts’, ‘go_dequeue_dashicons’ );
function go_dequeue_dashicons() {
if ( ! is_user_logged_in() ) {
if ( !is_page( array( 9, 10 ) ) || !in_category( array( 29, 2 ) ) ) {
wp_deregister_style( ‘dashicons’ );
}
}
}

The code works if I do not use the OR condition. In other words it works if I apply a sole IF statement either for the specific pages or for the specific categories. It doesn’t work if I use both IF statements under the OR condition. Which is the correction needed?

Read more here:: Remove dashicons.min.css conditionally

Leave a Reply

Your email address will not be published. Required fields are marked *