Unable to filter post types with OR operator
-
I am trying to limit the available post types like this: name = ‘cars’ or name = ‘movies’ and cannot get this to work.
add_filter( 'pts_post_type_filter', 'pts_cpt_enable'); function pts_cpt_enable( $args ) { $args = array( 'name' => 'cars', 'name' => 'movies' ); return $args; }
I see the plugin uses the default ‘and’ operator in the get_post_types() function, so I changed this to use ‘or’:
$post_types = get_post_types( $args, 'objects','or');
Still, the plugin only displays the ‘movies’ post type in this example. Any suggestions? Thank you.
- The topic ‘Unable to filter post types with OR operator’ is closed to new replies.