I'm trying to add an author filter to the WP Admin pages for the CPTs 'booking' and 'ticket' The code below works when using only one post type, but adding || and the second cpt stops it. I've tried an array but can't be writing that correctly either.
add_action( 'restrict_manage_posts', 'filter_author' );
function filter_author( $post_type ) {
if( 'booking' || 'ticket' !== $post_type ) {
return;
}
$selected = isset( $_GET[ 'user' ] ) && $_GET[ 'user' ] ? $_GET[ 'user' ] : '';
wp_dropdown_users(
array(
'role__in' => array(
'administrator',
'editor',
'author',
'contributor',
'subscriber'
),
'name' => 'author',
'show_option_all' => 'All authors',
'selected' => $selected
)
);
}