This isn’t a WordPress problem, it’s a programming logic mistake in this if
statement:
if( 'booking' || 'ticket' !== $post_type ) {
This code is the same as this:
if( ( 'booking' != false ) || ( 'ticket' !== $post_type ) ) {
Which in plain language is:
If “booking” is a truthy value, or the
$post_type
variable is not ‘ticket’, then this if statement is true
If you want to compare a variable to multiple strings, you need to do multiple comparisons, you can’t write something like this:
if ( $variable != A || B || C ) { // ❌
This might work when speaking to a human because that’s how people might speak it out loud, but this isn’t a sentence of language, it’s boolean logic.
You also can’t do this:
if ( $variable != [ A, B, C ] ) { // ❌
Because this isn’t asking if variable is one of those values, it’s asking if variable isn’t that array!
Remember that computers and code are extremely literal, you can’t imply things and hope it figures it out because there is no figuring out step.
What you need this:
if ( $variable !=== A && $variable !=== B && $variable !=== C ) { // ✅
Or, to put the values in an array/list and ask if the value appears inside that array:
$unwanted = [ A, B, C, D ];
if ( in_array( $variable, $unwanted ) ) { // ✅
// the variable appears inside the array/list