dimanche 11 août 2019

If statement for all except one

I am more familiar with JS than with PHP. What I would like to have, is a php condition that runs for all pages except one.

I would like below "only not for page ID 2":

function my_action() {
    if( is_page( 2 ) ) {
        // code here
    }
}

Does PHP cover also cover the ! exception rule and if so; where do I put this?

Aucun commentaire:

Enregistrer un commentaire