is_post_type_active_and_query_based() public method

Checks if the given post type is active and set to be query-based.
Since: 3.0.0
public is_post_type_active_and_query_based ( string $post_type ) : boolean
$post_type string Post type.
return boolean Whether or not the given post type is active and set to be query-based.
Example #1
0
 /**
  * Filters the post type link URL and returns a query-based representation, if set for the according post type.
  *
  * @since   3.0.0
  * @wp-hook post_type_link
  *
  * @param string  $post_link Post URL.
  * @param WP_Post $post      Post object.
  *
  * @return string The (filtered) post type link URL.
  */
 public function unprettify_permalink($post_link, WP_Post $post)
 {
     if (!$this->post_type_repository->is_post_type_active_and_query_based($post->post_type)) {
         return $post_link;
     }
     $post_type = get_post_type_object($post->post_type);
     if ($post_type->query_var && !$this->is_draft_or_pending($post)) {
         $args = [$post_type->query_var => $post->post_name];
     } else {
         $args = ['p' => $post->ID];
     }
     return site_url(add_query_arg($args, ''));
 }