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" />
</form>
Or even just:
mywebsite.com/?s=foo&post_type=course
etc
Related Posts:
- Adding a span when custom post type is updated
- Display children and grandchildren of a custom post type
- WP_Query search posts by custom post type and custom taxonomy
- Conditional to modify query results
- WP_Query is printing out only one post when posts_per_page is set to multiple
- WP Query to displaying date and posts for that date?
- Can’t get order_by meta_value_num to work properly
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Very Slow Page – How to Optimize # of Queries?
- How to make sure content doesn’t display if selection is empty
- creat filter with wp_query
- Configuring a meta query with multiple post types that have the same relationship on a single page
- How can I group posts by months and years?
- Loop increase number
- Using wp_query to modify the loop in index.php for a CPT
- WP_Query Custom Post Type if Category ID Equals
- Is This Code Efficient – Or is there a better way?
- Different options per post type in WP_Query
- Show message when query has no posts
- Undefined $post in wp_query
- Custom post type and custom taxonomy 404 on page 2
- List latest post out of 2 custom post types
- Using Wp_Query, Json to add Highcharts series data
- foreach loop inside the loop creating duplicates in output
- Foreach loop returning more than one item when querying taxonomy
- Page that lists publications by classifying them by taxonomy
- set object terms after some some time of published post – functions.php
- Alike Shortcode using in Custom Shortcode
- Query custom post type that has a serialized relational advanced custom field value
- Sort custom post column by generated value?
- WP_Query – How To Query Only Custom Posts With No Children of Their Own?
- wp_post_delete is deleting all offices
- Tell wordpress to show a single page instead of an archive page
- Custom Taxonomy – fields
- Custom Post By Category
- How to get the posts that my following users are liked?
- CPT post doesnt shows tags and category on backend admin page
- The most recent post of custom taxonomy
- WordPress loop add heading before first of type
- How to make a shortcode for my WP_Query Loop? [duplicate]
- Strange behavior on WP_query
- get_post_meta for Custom Post Type ( CPT )
- Loop carousel slider in wordpress
- Values inside a custom field to determine which category posts to display
- WordPress multi-query not returning as expected
- Trying to combine multiple WordPress queries
- Custom Post-type not returning the right child_of
- Pagination not working on homepage
- Query Custom Post Type by Tag
- How to manage wordpress knowledge base/wiki/posts collections
- Store custom post type with JSON content
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- Calculating Bayesian average for custom post type
- I am having a problem with form updating/editing WordPress post on the frontend
- How to filter out post type meta?
- Lists Posts from CPT that match the Title of the Page
- Help with CPT template pagination
- How to make in WordPress admin panel sortable column for the custom field, that count the number of page impressions?
- WP-Admin edit.php & post.php slowdown after import of 10k users
- CPT posts listed by category with custom rewrite URL, please help!
- How to query different post types in specific order?
- Help Structuring Query for Archive Pages
- Display custom field of specific post where post title matches variable
- How can I get the first 50% of all posts (within a custom post type)?
- Loop through posts of a custom-post-type (event) and create .ics (iCal) file?
- Output custom post shortcode. Help spot the error.
- Loop on front-page.php
- How to count custom post types with conditional operators
- Custom query shows custom post types in trash
- Multiple post type queries (with specific arguments for each)
- Is it possible to create a shortcode that will query a post based on taxonomies?
- Filtering by Post Meta Custom Fields – Performance
- tax_query returning all posts instead of selective posts in WP_Query
- wp_query to find posts by year and month
- Custom WP_Query not returning results when querying custom post type
- WP Query—Relationship between two custom post types and their fields
- GravityForm: Populate Dropdown with custom post type [closed]
- Return array of categories to php function for current post
- Link users to a custom post type
- Create a random unique 6 digit number as custom field for custom post type
- How to output wordpress custom tags separated by comma?
- How to dynamically attach pictures to a carousel
- Is it possible to apply a meta_query to one specific post type in a query with multilple post types?
- Remove duplicated values from a loop
- Loading all files within a directory
- Unable to get paginate_links working with a custom query [duplicate]
- Get custom posts with certain ids in a custom loop using a shortcode
- Querying Term Posts in Loop
- Blog page showing same content as homepage
- How to use WP_Query in a CPT achive page?
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- Use get_post_types to query only custom posts types
- WordPress Orderby Numeric Value Not Working
- Custom Post Type Loop within Shortcode
- Using several custom fields as custom post title
- Custom Post Type without an archive page
- Fetch taxonomies by custom post type id array
- Get rewrite slug of custom post type in template
- Show Different Header on a Specific Post ID
- Use WP_Query() to Output the 4th to 6th Most Recent Posts of a Custom Post Type