Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey
    I had the same problem and solved it with a filter for the WP_Query object, and a filter for the links.

    function alter_the_query_visitalocal( $request ) {
    
    	if($request['pagename']=='the-slug-you-like') return array('post_type' => 'job_listing');
    
    	return $request;
    }
    add_filter( 'request', 'alter_the_query_visitalocal' );

    And another filter for the links:

    add_filter('post_type_archive_link', 'change_url', 10, 2);
    /*Change at which page you arrive if you click the search button*/
    function change_url($link, $post_type){
    	if($post_type=='job_listing') return str_replace("/listing-region/", "/region/", $link);
    	return $link;
    }

    Put these into your functions.php, I hope it works

    Is there also a possibility to change the url of the search results in general? For example, at my page, the search leads to /hosts/ (/job-listings/). I want to change that so that the results are shown on the page /visit-a-local/

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)