Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_search_link [ WordPress Function ]

get_search_link ( $query = '' )
Parameters:
  • (string) $query Optional. The query string to use. If empty the current query is used.
Returns:
  • (string)
Defined at:



Retrieve permalink for search.

Source


<?php
function get_search_link$query '' ) {
    global 
$wp_rewrite;

    if ( empty(
$query) )
        
$search get_search_queryfalse );
    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 unencoded.
        
$link str_replace'%search%'$search$permastruct );
        
$link home_urluser_trailingslashit$link'search' ) );
    }

    return 
apply_filters'search_link'$link$search );
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics