Customize Search box

  • Val Wilson



    is there a way to customize the search box widget in Graphene so that it searches only posts and NOT pages?

    Thanks in advance



    Syahir Hakim


    The search box in Graphene is the standard WordPress feature. Try searching for a plugin that can restrict WordPress search feature to just posts.

    Val Wilson



    Adding the code below to functions.php file excludes pages from search

    //Exclude pages from WordPress Search
    if (!is_admin()) {
    function wpb_search_filter($query) {
    if ($query->is_search) {
    $query->set(‘post_type’, ‘post’);
    return $query;

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Do NOT follow this link or you will be banned from the site!