get_search_permastruct example


        $comments_rewrite = apply_filters( 'comments_rewrite_rules', $comments_rewrite );

        // Search rewrite rules.         $search_structure = $this->get_search_permastruct();
        $search_rewrite   = $this->generate_rewrite_rules( $search_structure, EP_SEARCH );

        /** * Filters rewrite rules used for search archives. * * Likely search-related archives include `/search/search+query/` as well as * pagination and feed paths for a search. * * @since 1.5.0 * * @param string[] $search_rewrite Array of rewrite rules for search queries, keyed by their regex pattern. */

function get_search_link( $query = '' ) {
    global $wp_rewrite;

    if ( empty( $query ) ) {
        $search = get_search_query( false );
    } else {
        $search = stripslashes( $query );
    }

    $permastruct = $wp_rewrite->get_search_permastruct();

    if ( empty( $permastruct ) ) {
        $link = home_url( '?s=' . urlencode( $search ) );
    } else {
        $search = urlencode( $search );
        $search = str_replace( '%2F', '/', $search ); // %2F(/) is not valid within a URL, send it un-encoded.         $link   = str_replace( '%search%', $search$permastruct );
        $link   = home_url( user_trailingslashit( $link, 'search' ) );
    }

    /** * Filters the search permalink. * * @since 3.0.0 * * @param string $link Search permalink. * @param string $search The URL-encoded search term. */
Home | Imprint | This part of the site doesn't use cookies.