Custom slug for search result

Greetings,

Have set all almost, but see now one issue.
When I am using search the results are here: site.com/?post_type=hp_listing&_category=&s=all

Is there any way to specify another path?
Like: site.com/SERVICES/?post_type=hp_listing&_category=&s=all

Thank you.

This may be possible, but WordPress-level customizations would be required. This is a standard WordPress search URL for custom post types, in this case it’s a “hp_listing” post type and HivePress just renders the search results but the URL is managed by WordPress.

I found this topic that may be useful Custom post type search with slug in URL - WordPress Development Stack Exchange

Thank you,

It works, don’t know how to make it using function.php from the child theme.
But here is the code:

public function __construct( $args = [] ) {
		$args = hp\merge_arrays(
			[
				'action' => esc_url( get_post_type_archive_link( 'hp_listing' ) ),
				'method' => 'GET',

				'fields' => [
					's'         => [
						'placeholder'  => hivepress()->translator->get_string( 'keywords' ),
						'type'         => 'text',
						'display_type' => 'search',
						'max_length'   => 256,
						'_order'       => 10,
					],

					'_category' => [
						'placeholder'  => hivepress()->translator->get_string( 'all_categories' ),
						'type'         => 'select',
						'display_type' => 'hidden',
						'options'      => 'terms',
						'option_args'  => [ 'taxonomy' => 'hp_listing_category' ],
						'_order'       => 5,
					],

					'post_type' => [
						'type'    => 'hidden',
						'default' => 'hp_listing',
					],
				],

				'button' => [
					'label' => hivepress()->translator->get_string( 'search' ),
				],
			],
			$args
		);

		parent::__construct( $args );
	}

File: class-listing-search.php

Hi,

Sorry for the inconvenience, but customization is beyond our support scope - it includes fixing bugs and guidance about the available features Support Policy | HivePress

If customizations are required for your site, please try customizing it using the collection of code snippets Search · user:hivepress · GitHub and other developer resources, or consider hiring someone for custom work https://fvrr.co/32e7LvY

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.