Creating a search results page from a custom post type in a plugin?

I have a forum system where I created a custom post type, and I would like to have a search system for the topics, but I do not know what the structure would be, for example, how the file will be and the search form action.

Topic custom-post-types Wordpress search

Category Web


You should try this in your search


global $query_string;

wp_parse_str($query_string, $search_query);
//add post type.
$post_type = array('post_type'=>'your-custom-post-type');
$combine_search = array_merge($search_query,$post_type);

$search = new WP_Query($combine_search);


I found an answer here, but it is treated as if I wanted a custom post type of a theme, in my case I created it as a Plugin, someone would have a light there of how I can create a search within a custom post type but that is Inside a plugin?

How to create a custom search for custom post type?

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.