How to display only child category post in related posts in custom post type?

Please follow the below steps. — Get the list of the parent term by using the below function get_term_parents_list for documentation of the function => https://developer.wordpress.org/reference/functions/get_term_parents_list/ — Get the ids of the posts that belongs to the parent taxonomy. — Use post__not_in() function in the query to remove the posts belongs to parent taxonomy.

Filter Custom Post Type Posts by Taxonomy

You would specify listas as the post_type in the Query arguments. And specify taxolistas along with any terms of the taxolistas taxonomy in a tax_query. $args = array( ‘post_type’ => ‘listas’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘taxolistas’, ‘field’ => ‘slug’, ‘terms’ => array ( ‘taxolistas-term1’, ‘taxolistas-term2’ ) ) ) );

Search result based on URL

You don’t and shouldn’t rely on referrers ( they can be stripped, hidden, or just outright lies ) Instead there are alternatives such as submitting to the post type archive: <form action=”/courses” method=”get”> <input type=”test” name=”s”/> </form> Or bundling query vars as hidden inputs: <form action=”” method=”get”> <input type=”test” name=”s”/> <input type=”hidden” name=”post_type” value=”course” /> … Read more