How To Make The WordPress Search URL Pretty

Frank from WPEngineer explains how to make pretty URLs for the WordPress search function. Also take a look in the comments on the post as Chuck Reynolds provides a snippet of code you can place in your htaccess file to accomplish the same thing.

3

3 responses to “How To Make The WordPress Search URL Pretty”

  1. Or with WordPress Rewrite Rules in functions.php :

    function feed_dir_rewrite( $wp_rewrite ) {
        $feed_rules = array( 'search/(.+)' => 'index.php?s=' . $wp_rewrite->preg_index(1));
        $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
    }
    add_filter( 'generate_rewrite_rules', 'feed_dir_rewrite' );

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Discover more from WP Tavern

Subscribe now to keep reading and get access to the full archive.

Continue reading