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
- Query all posts where a meta key does not exist
- Syntax to get the Nth item in a list of custom post types?
- How to show posts from multiple post types in a single loop? And display them separately on the same template
- how to use two permalinks for one custom post type
- Want to filter only parent post in admin area
- WordPress is executing URL in code when called via wp_mail()
- Display posts if a custom field value is equal to another custom field value
- CPT posts listed by category with custom rewrite URL, please help!
- Using several custom fields as custom post title
- Adding custom tables to WordPress
- Using global $post; to get featured image for custom post via WP_Query
- Query custom post type by category slug
- Return the thumbnail meta data for getter and setter
- Custom Post-Type not in admin menu
- Page vs Custom Post Types Differences/Issues
- Search / Filter posts on Title/Content OR Tags
- Set URL link to featured image of custom post type
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- How do I add a custom screen for a custom post type to be called from custom post row action?
- How to display custom WP menus?
- Pagination with custom query, custom search form, single and pages, ajax and no plugins
- Problems wp_insert_post and save_posts filter
- Cant get paginations on single.php to work with my custom post types
- Trying to Create a PHP Variable for post_type that can be referenced Site Wide
- Getting a custom post’s custom field based on another custom post’s custom field select
- Template code to split a post and print a custom field?
- Need help with simple “if statement” checks to output particlular CPT data depending on what client uploads/fills out
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- Ordering by meta value not working
- Display All Courses in Course Archive Page
- Custom wp-query display post only today
- Get all post under custom post type grouped by custom filed value in custom taxonomy
- Display Custom Post Type Based on Taxonomy With WP_Query()
- Show parent category and subcategory once in while loop
- Display related post content and custom field content
- Custom 404 redirect for a luddite
- How can you use a page for a custom post type?
- can’t see categories in appearance-menu-categories
- CPT Efficient way to display posts from different categories with custom query
- How To Loop Through list with Custom Post Types
- Use Tags to Query Associated Multiple Posts and Get The Average Of Custom Field Values
- Custom Post Type + Category archive
- Posts without featured image using other post’s featured image
- Pop up showing same content on all posts display.
- Building a List of Posts grouped by custom taxonomy as the section header only to be displayed if at least one post is in that tax
- Count of posts with meta_key filled in?
- Are custom posts included when getting a categories’ posts?
- Query order by meta value force specific tag first
- Custom post type is_singular condtional not working when managing sidebar display