• Resolved nekton

    (@nekton)


    Hi there

    Anyone know, how/if I can I hard code a search term for a (custom template) page?

    I need to create a page that returns all posts/pages etc that contain a specific keyword.

    So instead of having:
    mysite.com/?=wombats

    I will have a the url:
    mysite.com/wombats

    And that page that returns pages with “wombats” in.

    Thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter nekton

    (@nekton)

    doh! found it!

    // WP_Query arguments
    $args = array (
    	's'                      => 'brexit',
    );
    
    // The Query
    $query = new WP_Query( $args );
Viewing 1 replies (of 1 total)
  • The topic ‘Hard Coded Search’ is closed to new replies.